C Program To Find Factorial Of a Number Using Recursion - Another Logic

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

int fact(int n)
{
if(n==1)
return 1;

else
return(n*fact(n-1));

}

void main()
{
int n,facto;
clrscr();
printf("Enter Any Number  :  ");
scanf("%d",&n);

facto=fact(n);
printf("\n\nSolution :  %d !  = %d ",n,facto);

getch();

}
Share on Google Plus

About Akash Manhas

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment