Question
Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the
Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the Shrink function.
#include
int Square(int value);
int Cube(int value);
double shrink(int value);
int main ()
{
int intValue, menuSelect,Results;
intValue = 1;
// While a positive number
printf ("Enter a positive Integer : ");
scanf("%d", &intValue);
if (intValue > 0)
{
printf ("Enter 1 to calculate Square, 2 to Calculate Cube 3 to Shrink : ");
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 if (menuSelect == 3){
//call the shrink function
double Result=shrink(intValue);
printf("%d value after shrink %lf",intValue,Result);
}
}
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;
}
double shrink(int value){
return value/2;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started