Factorial of a Number using Function

/* Write a program to find Factorial of a Number using Function */

#include<stdio.h>
#include<conio.h>
void main()
{
long fact(int);
int num;
long f;
clrscr();
printf("\n Enter a number");
scanf("%d",&num);
f=fact(num);
printf("Factorial of %d is %ld",num,f);
getch();
}
long fact(int n)
{
int i;
long fl=1;
for( i=1 ; i<=n ; i++)
{
fl = fl * i;
}
return( fl );
}

Who's online

We have 14 guests and no members online

About Us

Harsimran Singh

Hello

This website is a special gift for Programming Lovers , which want to learn basic Programming Languages and want to develop there skills Read More....

Our work

Find Us

This email address is being protected from spambots. You need JavaScript enabled to view it.

Harsimran Singh(Facebook)

Harsimran Singh(about.me)

Harsimran Singh(G+)