#include<stdio.h>
#include<conio.h>
long int fact(long int);
void main()
{
long int num,f;
clrscr();
printf("Input a number: ");
scanf("%ld",&num);
f=fact(num);
printf("\nFactorial is %ld",f);
getch();
}
long int fact(long int n)
{
if(n==0)
return 1;
else
return(n*fact(n-1));
}
#include<conio.h>
long int fact(long int);
void main()
{
long int num,f;
clrscr();
printf("Input a number: ");
scanf("%ld",&num);
f=fact(num);
printf("\nFactorial is %ld",f);
getch();
}
long int fact(long int n)
{
if(n==0)
return 1;
else
return(n*fact(n-1));
}
No comments:
Post a Comment