// 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
c programming sample codes
ReplyDeletec program Create a Messagebox in C