C Program to Find Factorial of a Number
In this program, I have discussed about the C Program to Find Factorial of a Number.
Example of factorial of a number : 5: 1*2*3*4*5= 120 (answer)
int main()
{ int n,k=1,i;
printf("Enter a number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{ k+*i;
}
printf("The factorial is %d",k);
}
Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.
Enjoy programming in C.
0 comments:
Post a Comment