Social Icons

Saturday, 8 February 2014

Program to calculate the factorial

#include<stdio.h>
#include<conio.h>

void main()
{
long i,n,fact=1;
clrscr();     //to clear the screen

printf("\n Enter a Number : ");
scanf("%ld",&n);
for(i=n;i>=1;--i)
fact*=i;

printf("\n Factorial of %ld is : %ld",n,fact);
getch();     //to stop the screen
}



                                                Output






No comments:

Post a Comment