{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch06Sections1-5

# ch06Sections1-5 - 1 6.14 Exercises Problems and Projects...

This preview shows pages 1–3. Sign up to view the full content.

6.14 Exercises, Problems, and Projects 6.14.1 Multiple Choice Exercises 1. The code runs forever. 2. d o/while loop 3. It is a count-controlled loop. 4. true 6.14.2 Reading and Understanding Code 5. Enter an int > 3 Hello Enter an int > 5 Hello Enter an int > -1 6. Hello Enter an int > 3 Hello Enter an int > 5 Hello Enter an int > -1 7. Enter an int > 3 Enter an int > 5 Hello Enter an int > -1 Hello 8 . i is 20 and sum is 54 9. i is 9 and product is 336 10. i is 8 and product is 42 11. Hello Hello Hello Done 12. Hello Hello Hello Done 13. 3 14. 2034 15. i is 5 and sum is 10 16. i is 40 and sum is 60 17. 30 18. 40 19. 3 3 3 3 4 AF_CH06.doc Page 1 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
20. i is 7 and sum is 21 6.14.3 Fill in the Code 21. while( i != 5 ) { System.out.println( i ); i = (int) ( 5 * Math.random( ) + 3 ); } 22. System.out.print( "Enter an integer > " ); int value = scan.nextInt( ); while ( value != 20 ) { if (value >= start) System.out.println( value ); System.out.print( "Enter an integer > " ); value = scan.nextInt( ); } 23. int sum = 0; while( value != -1 ) { sum += value; System.out.print( "Enter an integer value > " ); value = scan.nextInt( ); } 24.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

ch06Sections1-5 - 1 6.14 Exercises Problems and Projects...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online