Question

1) What will each of the program segment display int x = 1; while (x < 10); x++; cout << x; int x = 1; while (x < 10) X++; co
0 0
Add a comment Improve this question Transcribed image text
Answer #1
segment 1:
------------
This forms an infinite loop and it stays in while loop forver.
so, nothing is printed on this segment
because there is a semi-colon(;) after while(x < 10)

segment 2:
-----------
10

even if the cout << x; is indented. it's not inside while loop because there is no {} after while loop.
so, only x++; is inside while loop
Add a comment
Know the answer?
Add Answer to:
1) What will each of the program segment display int x = 1; while (x <...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT