Question: #include int Square(int value); int Cube(int value); int main () { /* variable definition: */ int intValue, menuSelect,Results; intValue = 1; // While a positive

#include int Square(int value); int Cube(int value); int main () { /*#include

int Square(int value); int Cube(int value); 

int main ()

{

/* variable definition: */

int intValue, menuSelect,Results;

intValue = 1;

// While a positive number

while (intValue > 0)

{

printf ("Enter a positive Integer : ");

scanf("%d", &intValue);

if (intValue > 0)

{

printf ("Enter 1 to calculate Square, 2 to Calculate Cube : ");

scanf("%d", &menuSelect);

if (menuSelect == 1)

{

// Call the Square Function

Results = Square(intValue);

printf("Square of %d is %d ",intValue,Results);

}

else if (menuSelect == 2)

{

// Call the Cube function

Results = Cube(intValue);

printf("Cube of %d is %d ",intValue,Results);

}

else

printf("Invalid menu item, only 1 or 2 is accepted ");

}

}

return 0;

}

/* function returning the Square of a number */

int Square(int value)

{

return value*value;

}

/* function returning the Cube of a number */

int Cube(int value)

{ return value*value*value;

}

Modify the original code and add an additional function of your choice. The function should be unique and something you created for this assignment. Support your experimentation with screen captures of executing the new code. Prepare a test table with at least 3 distinct test cases listing input and expected output for your unique function

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!