Monday, December 26, 2011
7:57 PM

C Program to Find Factorial of a Number


Program to Find Factorial of a Number

#include
//declaration of functionint fact(int);void main(){int a,d; printf("enter the number: ");scanf("%d",&a);d = fact(a); //function callingprintf("\nthe factorial of entered number is %d",d);}//definition of function int fact(int x){int i=1,b=1 ; while(i<=x){ b = b*i; i++; } return b; }

0 comments:

Post a Comment