Q how to find factorial in c program |c programming examples
Ans: here is code that get input from user and print the n factorial
#include<stdio.h>int main()
{
int c,n,fact=1;
printf("enter a number calculate its factorial\n");
scanf("%d",&n);
for(c=1;c<=n;c++)
fact=fact*c;
printf("factorial of %d=%d\n",n,fact);
return 0;
}
No comments:
Post a Comment