// C program
#include<stdio.h>
void main()
{
int a,f=1;
clrscr();
printf("Enter a number:");
scanf("%d",&a);
for(int i=1,i<=a;++i);
{
f=f*i;
}
printf("Factorial of a number is %d",f);
getch();
}
Sample Input/Output:
Enter a number: 5
Factorial of a number is 120
#include<stdio.h>
void main()
{
int a,f=1;
clrscr();
printf("Enter a number:");
scanf("%d",&a);
for(int i=1,i<=a;++i);
{
f=f*i;
}
printf("Factorial of a number is %d",f);
getch();
}
Sample Input/Output:
Enter a number: 5
Factorial of a number is 120
No comments:
Post a Comment