Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

6. How does light reset the biological clock?

Answered: 1 week ago