Thursday, 29 September 2011

Facotrial of a number in c language

/* Program to print the factorial of a number */




#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,n;
long double f=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
for(i=n;i>0;i--)
f=f*i;
printf("\n The factorial of the entered number= %ld",f);
getch();
}

No comments:

Post a Comment