Friday, June 07, 2013

C Program to find the factorial of a number

Leave a Comment Follow us on twitter
Below written is the C Program to find the factorial of n numbers where n is any input number by user whose factorial is to be computed. So, let's see the program to find factorial of number in C language.



#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int fact=1,n,i;
printf("Enter the number whose factorial you want to find : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
fact=fact*i;
printf("\nFactorial of %d is : %d",n,fact);
getch();
}

Output:


Enter the number whose factorial you want to find : 5

Factorial of 5 is : 120

0 comments:

Post a Comment