Pages

Saturday, 19 May 2012

program to find out the Factorial Number


36/*Write a program to find out the Factorial Number*/

#include<stdio.h>
#include<conio.h>
void main()
{
long int fact=1,num,i;
clrscr();
printf("ENTER A NUMBER:");
scanf("%ld",&num);
for(i=num;i>0;i--)
{
fact=fact*i;
}
printf("The Factorial Value for %ld is %ld",num,fact);
getch();
}


OUTPUT
            ENTER A NUMBER:4
            Factorial Value for 4 is 24


No comments:

Post a Comment