Saturday, January 30, 2010

CHAP 3[B]b Finding Factorial

Write a program to find the factorial value of any number entered through the keyboard.

void main()
{
float d,t;
t=1;
printf("\nEnter a number to find its factorial");
scanf("%f",&d);

while(d>0)
{
t*=d;
d--;
}

printf("\nThe factorial of the number is %f",t);

}

No comments:

Post a Comment