Write a C program to find factorial of any number?

All QuestionsCategory: C LanguageWrite a C program to find factorial of any number?
Chetan Shidling Staff asked 5 years ago

Info

1 Answers
Chetan Shidling Staff answered 5 years ago

Code:

#include<stdio.h>
int main()
{
int n,i;
int m =1;
printf(“enter number for factorial “);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
m=m*i;
printf(“value of factorial=%d”,m);
//Chetan Shidling
return 0;
}
//CS Electrical & Electronics

Output:

enter number for factorial 4
value of factorial=24