View Single Post
 
Reply
Posted 2002-05-01, 03:42 AM in reply to CrOnIc-KiLlA's post "World Record Thread"
#include <iostream.h>
#include <conio.h>

//Returns the factorial of n
int Factorial(int n) {
//Loop variable
int i;
int Result;

//Initialize the result
Result = 1;

//Now multiply by 1 .. n
for (i = 1; i < n; i++)
Result *= i;

return Result;
}

void main() {
int n;

//Get a value
cout << "Welcome to the oh-so-leet Grandfather price calculator" << endl;
cout << "How many Grandfathers are you planning on selling?" << endl;
cin >> n;

//Print the factorial
cout << Factorial(n);

//Now pause until user hits a key
cout << "\nYou would obviously get $" << Factorial(n) << " dollars out of that Ebay sale" << endl;
cout << "Remember that Chruser owns you" << endl;
while (!kbhit());
}
"Stephen Wolfram is the creator of Mathematica and is widely regarded as the most important innovator in scientific and technical computing today." - Stephen Wolfram
Old
Profile PM WWW Search
Chruser never puts off to tomorrow what can be done the day after tomorrowChruser never puts off to tomorrow what can be done the day after tomorrowChruser never puts off to tomorrow what can be done the day after tomorrowChruser never puts off to tomorrow what can be done the day after tomorrowChruser never puts off to tomorrow what can be done the day after tomorrow
 
 
Chruser