Math/Programming Puzzle: Use of functions
This little *puzzle* I made are for those C/C++ programmers who are good with math and such. In the following source code, I will make a bunch of functions that will take a constant numeric variable and perform mathematical operations with that constant variable. Now, the purpose of the puzzle is for you programmers to use those functions to reach a certain number. You could use the function as many times as you'd like.
Here is an example:
const variable= 9;
goal to reach= 63;
Code:
#include <iostream>
using std::cout;
int a( int );
int b( int );
int main( int argc, char *argv[] )
{
const int cNum= 9;
int tempNum;
tempNum= a( cNum );
tempNum= b( cNum ) + a( tempNum );
cout << tempNum;
cin.get();
return 0;
}
int a( int Number )
{
return( Number * 2 );
}
int b( int Number )
{
return( Number * 3 );
}
I hope you understand the concept. I will post the first *mission* next.