The C Programs
An ultimate blog where you can find almost all C programs.....!!
Pages
Home
Contact Us
Sunday 20 May 2012
C program to calculate the factorial of an integer
#include<stdio.h>
#include<conio.h>
void main()
{
long i,n,fac=1;
clrscr();
//to clear the screen
printf("Enter value of n:");
scanf("%ld",&n);
for(i=n;i>=1;--i)
fac*=i;
printf("\nFactorial of %ld is %ld",n,fac);
getch();
//to stop the screen
}
C program to calculate the factorial of an integer
2012-05-20T16:15:00-07:00
Neeraj Mishra
loop|
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)