Question: Write the mysterious function enigma into a program and test it with some values. Try to figure out what enigma does, and why it does
Write the mysterious function "enigma" into a program and test it with some values. Try to figure out what enigma does, and why it does it. Turn in a paragraph discussing your theory on what enigma does, along with an explanation of why it does what you say. Also, answer the following question: Is enigma a "cool" function or a "stupid" function.
int enigma( int a, int b )
{
if( b == 0 )
{
return 1;
}
else
{
int x = enigma( a, b/2 );
if( b % 2 == 0 )
{
return x*x;
}
else
{
return x*x*a;
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
