Sunday, March 21, 2021

 #include <stdio.h>

long int factorial(int number) //function definition
{
    if (number == 1 || number == 0) //base condition
    {
        return 1;
    }
    else
    {
        return (number * factorial(number - 1)); //function recalling
    }
}
int main()
{
    long int num;
    printf("enter the number you want factorial of : \n");
    scanf("%d", &num);
    printf("the factorial of %ld is %ld", num, factorial(num)); //function call
    return 0;
}

No comments:

HackCache ’26: A 48-Hour Online Hackathon Open to Every Student

  Hackathons are often associated with computer science students, experienced developers, and teams that already know exactly what they are...

Popular Posts