Answer to Question #15866 in C++ for Diwakar

Question #15866
What will be the output of the given program and why? main() { int x=3,y,z; y=x=10; z=x<10; printf("\n x=%d y=%d z=%d",x,y,z); }
Expert's answer
int x=3,y=0,z;

y=x=10; // <-- x and y set to 10

z=x<10; // <-- z is set to 0, as the logical expression "x<10"is false

printf("
x=%d y=%d z=%d",x,y,z); // output will be: x=10 y=10 z=0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal