expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
Exercise 3
Using a Counter-Controlled while Loop
In this exercise, you use what you have learned about counter-controlled loops. Study the following code, and then answer Questions.
Using a Counter-Controlled while Loop  In this exercise, you use what you have learned about counter-controlled loops. Study the following code, and then answer Questions.     Remember that number2 += number1; is the same as number2 = number2 + number1;.int number1 = 0;int number2 = 0;while(number1 6)number1++;number2 += number1;  If the statement number1++ is changed to ++number1, what is the value of number1 when the loop exits?
Remember that number2 += number1; is the same as number2 = number2 + number1;.int number1 = 0;int number2 = 0;while(number1 6)number1++;number2 += number1;
If the statement number1++ is changed to ++number1, what is the value of number1 when the loop exits?
Explanation
Verified
like image
like image

Counter-controlled while loop:
In while...

close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon