#include<stdio.h>
#include<conio.h>
int main()
{
int n,t,f=1;
clrscr();
printf("Enter Value");
/*Read the n value */
scanf("%d",&n);
/*Logic for factorial */
for(t=n;t>0;t--)
{
f=f*t;
}
printf("The factorial of the %d is %d",n,f);
getch();
}
output
#include<conio.h>
int main()
{
int n,t,f=1;
clrscr();
printf("Enter Value");
/*Read the n value */
scanf("%d",&n);
/*Logic for factorial */
for(t=n;t>0;t--)
{
f=f*t;
}
printf("The factorial of the %d is %d",n,f);
getch();
}
output
Enter Value5
The factorial of the 5 is 120
The factorial of the 5 is 120
0 comments:
Post a Comment