55.6k views
0 votes
Program to find a factorial in c language by calling a function factorial()

User Sophocles
by
8.9k points

1 Answer

4 votes

#include <stdio.h>

int factorial(int n) n == 1) ? 1 : n * factorial(n-1);

int main() {

//Print factorial.

int input;

scanf("%d", &input);

printf("%d", factorial(input));

return 0;

}

User Illep
by
8.0k points