Write a recursive function that accepts a number as its argument and returns its factorial. Call the function in main().

Source Code

#include <stdio.h>

int factorial(int);

int main()
    int number;

    printf("Enter an integer value : ");
    scanf("%d", &number);
    printf("The factorial of %d is %d", number, factorial(number));

int factorial(int num)
    if (num == 0)
        return 1;
        return num * factorial(num - 1);


Enter an integer value : 5
The factorial of 5 is 120