Coding—
#include<stdio.h>
#include<conio.h>
void main()
{
int n=5,f=1;
clrscr();
printf("enter the terms");
scanf("%d",&n);
while(n>=1)
{
f=f×n;
n––;
}
printf("Factorial value=%d",f);
getch();
}
Output—
Enter the terms:3
Factorial value=6
#include<stdio.h>
#include<conio.h>
void main()
{
int n=5,f=1;
clrscr();
printf("enter the terms");
scanf("%d",&n);
while(n>=1)
{
f=f×n;
n––;
}
printf("Factorial value=%d",f);
getch();
}
Output—
Enter the terms:3
Factorial value=6
Comments
Post a Comment
Please Subscribe and Comments my blog site.