Please answer my Q | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please answer my Q

#include <iostream> using namespace std; int main () [ int y,x,z; y=x=z=1; y= ++x + ++x + x++; z - =x; cout <<x<<y<<z; return o; ]

12th Oct 2016, 4:55 PM
Mohammed Aljezawi
Mohammed Aljezawi - avatar
2 Answers
+ 2
Output is 4 9 -3 Because First x is 1 then due to 2 pre increments x becomes 3 and then y=3+3+(3++) So y is 9 And x becomes 4 Then z=z-x Thus z is 1-4 that is -3 /*Note different compilers treat in different ways*/
14th Oct 2016, 1:41 PM
Soutik
Soutik - avatar
- 3
x=1 y=8 z=0
12th Oct 2016, 5:56 PM
Asim
Asim - avatar