Ask Question - Get Answer

1 Ans Write a C Program to find factorial using recursion

Asked by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:12 PM at (Education Tutorials)

Please log in to answer, like and save
0
Save 0

<<< Previous
Log in to Answer Next >>>

Answer(s):

A C program to find factorial using recursion.


#include<stdio.h>

int factorial(int n)

{

    if(n==0)

        return 1;

    else

        return n*factorial(n-1);

}

int main()

{

    int n, result;

    printf("Enter a positive integer: \n");

    scanf("%d", &n);

    if(n>=0)

    {

        result=factorial(n);

        printf("Factorial = %d", result);

    }

    else

        printf("Please Enter a positive Integer! ");

    return 0;

}


Answered by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:13 PM

Please log in to Upvote, Downvote and Report
           

Related Q/A:

1 Ans Single Digit Interest Rate in the Banking Sector: Problems and Prospects - essay writing

1 Ans Write a C program to check a Palindrome Number

1 Ans Write a C program to find the highest and lowest number in a series

1 Ans Which is the best and easy C programming learning website ?

1 Ans Write a C program to print Fibonacci number using recursion

1 Ans Write a C program for Interest Calculation

1 Ans Write a C program to check a perfect number

1 Ans Write a C Program to find factorial using recursion

1 Ans Write a C++ program for BigMod math

3 Ans BPSC Assistant Programmer Lab Aptitude test Programs and Queries with Proper solution (Taken By BCC)