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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!