Monday 21 May 2012

PROGRAM TO CALCULATE FACTORIAL OF INPUTTED NUMBER


#include<stdio.h>
#include<conio.h>
void main(){
int fact=1,i,n;
clrscr();
printf("enter the number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("factorial of the given number is %d",fact);
}

Output:-
enter the number4
factorial of the given number is 24


No comments:

Post a Comment