Science, asked by utpalm9733, 7 months ago

Q. Write a C program to find the factorial of a number. a. Algorithm b. Input statement. Code for finding factorial of a number. Output statement​

Answers

Answered by priyans0531x
0

Answer:

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