Top Special Offer! Check discount
Get 13% off your first order - useTopStart13discount code now!
Modeling the Square and Cube functions, Create a program that has a “Shrink” function that takes an integer and returns the integer divided by two. (Hint: your returned value should most likely be of the double type.) Screen captures of the new code being executed can help you with your experimentation.
Include stdio.h> in your code.
/ Prototypes of functions
integer Shrink(int value); integer Main ()
/* variable definition: */ int intValue, menuSelect, Results; intValue = 1; / Whereas a positive integer is present, while (intValue greater than 0)
{ printf (””Enter a positive Integer\n: ””); scanf(””%d””, &intValue); if (intValue > 0)
{ printf (””Enter 1 to calculate Shrink\n: ””); scanf(””%d“”, &menuSelect); if (menuSelect == 1)
{// Call the Square Function
Results = Shrink(intValue);
printf(”Shrink of %d is %d\n”,intValue,Results);
}
}
return 0;
}
}
/* function returning the Shrink of a number */
int Shrink(int value)
{
return value/2;
}
Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created after step 1.
Test Case #
Value
Expected outcome
1
8
4
2
14
7
3
16
8
Test case 1
Test case 2
Test Case 3
What would happen if you removed the following code from our design?
If intValue > 0
Support your argument with screen captures of executing the new code.
Removing the code if intValue > 0 would result in the program giving an output for negative value but only for one time. The explanation to this would be because after all calculations once the loop is checked the negative value will make the condition false therefore the control will exit the loop.
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.
Test Case
Value
Expected outcome
1
3
1.442
2
5
1.7099
3
6
1.8177
Hire one of our experts to create a completely original paper even in 3 hours!