You are on page 1of 1

------------------------------------------------------------------------------------------------------------------------------Problem: Function that print Factorial.

------------------------------------------------------------------------------------------------------------------------------#include <conio.h>
#include <stdio.h>
double factorial(int);
void main()
{
clrscr();
int n;
double res;
printf("Enter any no: ");
scanf("%d",&n);
res=factorial(n);
printf("\nFactorial = %lf",res);
getch();
}
double factorial(int no)
{
double f=1;
for(int i=no;i>=1;i--)
{
f=f*i;
}
return f;
}

URL: http://mylcphs.com/ics.html
E-Mail: farhan.saleem@hotmail.com
Instructor: Muhammad Rana Farhan

You might also like