C Code:
#include<stdio.h>
void main()
{
long int m,n,Fact=1;
printf("Enter any Number:--\n");
scanf("%ld",&m);
n=m;
while(n>0)
{
Fact=Fact*n;
n=n-1;
}
printf("Factorial of Number %ld is %ld\n",m,Fact);
}
Output:
#include<stdio.h>
void main()
{
long int m,n,Fact=1;
printf("Enter any Number:--\n");
scanf("%ld",&m);
n=m;
while(n>0)
{
Fact=Fact*n;
n=n-1;
}
printf("Factorial of Number %ld is %ld\n",m,Fact);
}
Output:
Enter any Number:--
6
Factorial of Number 6 is 720
No comments:
Post a Comment