What is the output of the following C++ code? (2, 5 to 6)
♥ 0 |
The number in parentheses at the end of an exercise refers to the learning objective listed at the beginning of the chapter. int x = 15; int y = 3; if (x + y > 17 || y – x < 20) { y = x - y; x = y + x; cout << x << " " << y << " " << x + y << " " << y - x << endl; } else { x = y - x + y %5; cout << x << " " << y << " " << x - y << " " << x + y << endl; } |
Answer and Explanation
Explanation
Step by Step Execution :
x: 15, y = 3
x+y : 18
y-x : -12
x + y > 17 is true. If block will execute.
y = x - y : 12
x = y + x : 27
Output x: 27 y: 12 x+y : 39 y-x :-15
27 12 39 -15
Purchase this answer to view it.
Click the button to login/signup and buy full solution at 2 USD only.
The Best Research Paper Writing Service
Would you want to pay someone to write your paper professionally from scratch? 100% Original and 0% AI Content!.
🎓 Write my Essay
📚 Write my Persuasive Essay
📋 Humanize AI Content for Turnitin
💻 Write my Reflective Essay
📑 Write my Research Paper
📜 Write my Thesis Paper
📘 Write my Dissertation
📋 Write my Case Study
📝 Write my Online Exam
✒️ Write my Term Paper