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);
}
1
Expert's answer
2012-10-04T09:48:23-0400
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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS