Saturday, 10 December 2011

Write a program to find out the Factorial Number in c

#include
#include
void main()
{
long int fact=1,num,i;
clrscr();
printf("ENTER A NUMBER:");
scanf("%ld",&num);
for(i=num;i>0;i--)
{
fact=fact*i;
}
printf("The Factorial Value for %ld is %ld",num,fact);
getch();
}


OUTPUT
ENTER A NUMBER:4
Factorial Value for 4 is 24

No comments:

Post a Comment