Write a program that uses a recursive function fact() that finds the factorial of a given number N.
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int fibo(int);
int a,f;
clrscr();
printf("\nEnter The Number of Factorial:");
scanf("%d",&a);
f=fibo(a);
printf("\nThe Factorail:%d",f);
getch();
}
int fibo(int x)
{
int i,f=1;
for(i=x;i>=1;i--)
f=f*i;
return(f);
}
OUTPUT:
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int fibo(int);
int a,f;
clrscr();
printf("\nEnter The Number of Factorial:");
scanf("%d",&a);
f=fibo(a);
printf("\nThe Factorail:%d",f);
getch();
}
int fibo(int x)
{
int i,f=1;
for(i=x;i>=1;i--)
f=f*i;
return(f);
}
OUTPUT:
Comments
Post a Comment