2 July 2018

[TCS] Factorial of a number using recursion [Solved]

Solution:
#include<stdio.h>
#include<conio.h>

int fact(int);
main()
{int y,n;
printf("Enter a number to find its factorial\n");
scanf("%d",&n);

y=fact(n);
printf("factorial = %d",y);
getch();
 }
 int fact(int x)
 {
  if(x>1)
  return x*fact(x-1);
  else
  return 1;

}
www.matterhere.com - Nareddula Rajeev Reddy (NRR)
Programming Geek
Source: programmaniaa blog.

*To get the more, view the [TCS] Factorial of a number using recursion [Solved]. These are only for reference purpose.