Computer Science, asked by muralimani212, 4 months ago

Write a program to find the factorial of a number.​

Answers

Answered by AbhiThakur07
0

Explanation:

C program to find factorial of a number

long factorial(int);

int main() { int n;

printf("Enter a number to calculate its factorial\n"); scanf("%d", &n);

printf("%d! = %ld\n", n, factorial(n));

return 0; }

long factorial(int n) { int c; long r = 1;

for (c = 1; c <= n; c++) r = r * c;

return r; }

Similar questions