A Function Factorial Which Receives An Integer Value And Returns Its Factorial As Long Integer Value
/* A Function Factorial Which Receives An Integer Value And Returns Its Factorial As Long Integer Value. */ #include
#include
void main() { int n; long res; clrscr(); printf("\n enter a integer value \n"); scanf("%d",&n); res=fact( n); printf("\n factorial of %d=%d",n,res); } long fact(int n) { long r=1; while(n>0) { r=r*n; n--; } return(r); getch(); }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/