Sunday, August 20, 2006

Calculation of Factorial using Functions.

Write a function to calculate the factorial value of any integer entered through
the keyboard.


#include<stdio.h>
main()
{

int i, f;
int factorial();

printf("Enter the number to evaluate its factorial:");
scanf ("%d", &i);

f=factorial(i);

printf("%d! = %d\n", i, f);

}

factorial(int num)
{
int temp, fact;


for (temp=1,fact=1;temp<=num; temp++)
{

fact=fact*temp;
continue;
}
return (fact);



}






The file can be found at:
Download File

2 comments:

surya said...

become a follower for free C,C++ And vb code of my blog:
http://www.a2zhacks.blogspot.com to learn C,C++,VB programming.

shamim bscbd said...

very good program