Find Factorial of A Number
In this program we learn how to find factorial of A Number provided by user using C.C program to find factorial of A Number
// Find Factorial of A Number
#include<stdio.h>
#include<conio.h>
void main()
{
long int n, i, f = 1;
clrscr();
printf("\n Enter a number : ");
scanf("%ld",&n);
for(i = 1; i <= n; i++)
f = f * i;
printf("\n The factorial of %ld is : %ld",n,f);
getch();
}
OUTPUT:
Enter a number : 4
The factorial of 4 is : 24
The factorial of 4 is : 24
No comments:
Post a Comment