Question: Trace the code of the program to find out the program output. Hand trace the code using a table showing the values of the

Trace the code of the program to find out the program output. 

Trace the code of the program to find out the program output. Hand trace the code using a table showing the values of the variables at each iteration. Which is the program output with inputs x 10 and y = 2? Which is the program output with inputs x = 10 and y = 3? Explain the relationship between the inputs x, y and the output values. #include using namespace std; int main() { int x 10, y 3, output1, output2; output1 = x; output2 = 0; while (output1>- y) { output1 output2++; } output1 - y; cout < < "the output of while is < < < < output1 < < " "; output1 -x; " < < output2 for (output2 0; output1>- y; output2++) output1 output1 - y; cout < < "the output of for is. < < < < output1 < < " "; output1 - x; output2 = 0; do { output1 output1 -yi output2++; } while (output1 >= y); " < < output2 cout < < "the output of do while is " < < output2 < < < < output1 < < " ";

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 Programming Questions!