Program to find the factorial
of a given number
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
long n, i, f = 1;
clrscr();
printf("Enter a number : ");
scanf("%ld", &n);
for(i = 1 ; i <= n ; i++)
f = f * i;
printf("\nFactorial value of %ld is : %ld", n, f);
getch();
}
Output:
Enter a number : 5
Factorial value of 5 is : 120
-
UpdatedDec 30, 2019
-
Views6,727
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order