#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{ clrscr();
int n,f;
printf("enter the no.\n");
scanf("%d",&n);
f=fact(n);
printf("FACTORIAL=%d\n",f);
getch();
}
int fact(int x)
{ int y;
if(x==0||x==1)
{ return 1;
}
else
{ y=x*fact(x-1);
} return y;
}
#include<conio.h>
int fact(int);
void main()
{ clrscr();
int n,f;
printf("enter the no.\n");
scanf("%d",&n);
f=fact(n);
printf("FACTORIAL=%d\n",f);
getch();
}
int fact(int x)
{ int y;
if(x==0||x==1)
{ return 1;
}
else
{ y=x*fact(x-1);
} return y;
}
No comments:
Post a Comment