CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int rec(int),fact,x;
clrscr();
printf("Enter any number ");
scanf("%d",&x);
fact=rec(x);
printf("\n\nFactorial of %d = %d",x,fact);
getch();
}
int rec(int a)
{
int b;
if(a==1)
return(1);
else
b=a*rec(a-1);
return(b);
}
#include<stdio.h>
#include<conio.h>
void main()
{
int rec(int),fact,x;
clrscr();
printf("Enter any number ");
scanf("%d",&x);
fact=rec(x);
printf("\n\nFactorial of %d = %d",x,fact);
getch();
}
int rec(int a)
{
int b;
if(a==1)
return(1);
else
b=a*rec(a-1);
return(b);
}
CODING |
OUTPUT |
For any query or suggestion please comment below...
No comments:
Post a Comment