Program Using Interactive Iterations To Display The Factorial Of A Given Number
/* Program Using Interactive Iterations To Display The Factorial Of A Given Number */ #include
#include
void main() { long int n,t; char ch; long fact=1; clrscr(); do { printf("\nEnter a number\n\n"); scanf("%ld",&n); t = n; fact = 1; while(n>0) { fact = fact*n; n--; } printf("\nfactorial of %ld = %ld",t,fact); fflush(stdin); printf("\n\nEnter 'y' or 'Y' to continue\n\n"); ch=getchar(); } while(ch=='y'||ch=='Y'); getch(); }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/