Pages

This blog is under construction

Sunday, January 6, 2019

C program to find factorial of a input number.

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:

Enter any Number:--                                                                                                            
6                                                                                                                              
Factorial of Number 6 is 720 

No comments:

Post a Comment