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

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.