SJSU/Udacity CS046

Lesson 6.2 - Loops

  1. Quiz: Input Validation
  2. The Do Loop
  3. Quiz: Accept Values Between 0 and 100
  4. How to Read Multiple Values
  5. Processing Sentinel Values
  6. Quiz: Average
  7. Quiz: Average with Q as Sentinel
  8. Quiz: Average of No Inputs
  9. Quiz: NaN
  10. Quiz: Find The Maximum
  11. Quiz: Reading from File
  12. Quiz: The Most Populous Country
  13. Common Algorithms
  14. Quiz: Counting Matches
  15. Quiz: Counting Matching Digits
  16. Quiz: Finding the First Match
  17. Quiz: What If There Are No Long Words?
  18. Quiz: Fix the Long Word Finding Code
  19. Quiz: Finding the Position of the First Match
  20. Quiz: Nested For Loops
  21. Quiz: Clock Times
  22. Quiz: Triangle Pattern
  23. Quiz: Telescope
  24. Quiz: Random Numbers
  25. Quiz: Computing Pi with Darts
  26. Quiz: Throwing a Die
  27. Quiz: The Chevalier de Meré
  28. Quiz: Estimating Pi Using Buffon Way
  29. Quiz: Using the Debugger 1
  30. Quiz: Using the Debugger 2
  31. Quiz: Using the Debugger 3
  32. Quiz: Using the Debugger with Sara 1
  33. Quiz: Using the Debugger with Sara 2
  34. Quiz: Using the Debugger with Sara 3
  35. Quiz: Hello Yellow Peach
  36. Quiz: Figuring out What is Wrong
  37. Quiz: What Happens Next
  38. Quiz: How Would We Fix That
  39. Quiz: Let us Fix the Code
  40. Fixing the code

Quiz: Input Validation

  1. Blue?
    int value = 100;
    while (value >= 100)
    {
       System.out.print("Enter a value < 100: ");
       value = in.nextInt();
    }
  2. Black?
    System.out.print("Enter a value < 100: ");
    int value = in.nextInt();
    while (value >= 100)
    {
       System.out.print("Enter a value < 100: ");
       value = in.nextInt();
    }
    
  3. Both?
  4. Neither?

Problem on this page?

Your name:

Your email address:

Problem description:

To protect against spam robots, please answer this simple math problem:
× =