1#include<stdio.h>
2fact(int i, int k){
3 k=k*i;
4 i--;
5 if(i==0){
6 return k;
7 }
8 else{
9 fact(i, k);
10 }
11}
12int main()
13{
14 int k = 1, i, factorial;
15 scanf("%d",&i);
16 factorial = fact(i, k);
17 printf("%d\n",factorial);
18 return 0;
19}
1#include <stdio.h>
2
3unsigned long long int factorial(unsigned int i)
4{
5if(i <= 1)
6{
7 return 1;
8}
9 return i * factorial(i - 1);
10}
11
12int main() {
13 int i = 12;
14 printf("Factorial of %d is %d\n", i, factorial(i));
15 return 0;
16}
1#include <stdio.h>
2
3unsigned long long int factorial(unsigned int i) {
4
5 if(i <= 1) {
6 return 1;
7 }
8 return i * factorial(i - 1);
9}
10
11int main() {
12 int i = 12;
13 printf("Factorial of %d is %d\n", i, factorial(i));
14 return 0;
15}