Find the Output Produced by the Program
What is the output produced by the following code? int x = -42; do { i. cout << x << endl; ii. x = x - 3; while (x > 0);
Answers
Answered by
0
int x = -42;
do {
cout << x << endl ;
x = x - 3 ;
} while (x > 0) ;
Output:
-42
do {
cout << x << endl ;
x = x - 3 ;
} while (x > 0) ;
Output:
-42
Answered by
0
C++ Programming Language
Output:
-42
Explanation:
The following are the description of the program.
- Declare the integer data type variable 'x' and initialize -42 in it.
- Set the do-while loop statement that executes one more time as compared to the other loop, inside the loop it prints the variable 'x'.
- Then, subtract x from 3, if they print after the calculation then it prints -45, but they print before the calculation.
Learn More:
https://brainly.in/question/8806056
Similar questions