Write a program to calculate the Factorial of a given number using recursive function

#include<stdio.h> long int fact(int); int main() { int n; long int f; printf("Enter any number: "); scanf("%d",&n); f=fact(n); printf("Factorial of %d = %ld",n,f); return 0; } long int fact(int n) { if(n!=0) { return n*fact(n-1); } else return 1; }

**Output**

Enter any number: 4

Factorial of 4 = 24