Write a C program to find the factorial of a number
#include<stdio.h>
int main()
{
int fact=1,number,i;
printf("Enter the number: ");
scanf("%d", &number);
for(i=1;i<=number;i++)
{
fact=fact*i;
}
printf("Factorial of %d is: %d", number,fact);
return 0;
}
Comments
Post a Comment