PROGRAM-18


// Program of finding factorial
#include
#include
void main()
{
clrscr();
int i,fact=1,num;
printf("enter the number\n");
scanf("%d", &num);
if(num<=0)
   fact=1;
else
{
   for(i=1;i<=num;i++)
   fact*=i;
}
printf("Factorial of %d =%5d\n", num, fact);
getch();
}




Algorithm

·                     Start
·                     Declare i, fact=1, num as integer
·                     Write(“the number”)
·                     Read(“the number”)
·                     if(num<=0)
·                     fact=1
·                     else
·                     for(i=1;i<=num;i++)
·                     fact*=i
·                     Read(“Factorial of number”)
·                     Stop


#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 comments: