C programing: factorial of a number
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
void fact(int);
clrscr();
printf("Enter a number :
");
scanf("%d",&n);
fact(n);
getch();
}
void
fact(int n)
{
int i;
double fact = 1;
for(i=1 ; i<=n ; i++)
{
fact *= i;
}
printf("The factorial of %d is
%f",n,fact);
}
CSE, IUBAT
No comments