1.

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

Answer»

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; }



Discussion

No Comment Found