C program – Calculate the factorial of a number using recursion

by Nideesh C on May 11, 2011 · 0 comments

in C Programming




//Downloaded From theonlinetutorials.com
//Source code
#include"stdio.h"
#include"conio.h"
int fac(int n){
if(n<0)
return 0;
if(n==1||n==0)
return 1;
else
return n*fac(n-1);
}

int main()
{
int n=5;
int i;
printf("Enter the no to find the factorail \n");
scanf("%d",&n);
printf("Factorail of the no is %d ",fac(n));
getch();
return 0;
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C++ program – calculate the factorial of a number using recursion.
  2. C program – Calculate the greatest Common Divisor (GCD) of a number
  3. C program to find the factorial of a given number
  4. C Program – Random Float number Generator
  5. C Program – Print the number which are not occurred in Fibonacci Series

Leave a Comment

Previous post:

Next post: