Monday, June 13, 2011

Factorial


 #include<stdio.h>
 #include<conio.h>
 void main()
 {
 int n,fac =1,i;
 printf("Enter the number for which the factorial is to be found :") ;
 scanf("%d",&n);
 for (i=1;i<=n;i++)
 fac*=i;
 printf("The factorial of %d is %d",n,fac);
 getch();
 }

No comments:

Post a Comment