Presentation is loading. Please wait.

Presentation is loading. Please wait.

More Loops.

Similar presentations


Presentation on theme: "More Loops."— Presentation transcript:

1 More Loops

2 While loops review while(condition(s)) { // body of the loop } Loop will execute until the condition is false

3 Do While loop do { // body of the loop } while(condition(s)) Exact same as while loop except the difference is that the loop condition is tested at the end. That means the body of the loop is run at least once.

4

5 Use a do while loop to display every number between 0-100, put a space between each one, no end line.

6 Using a do while loop, output every character from ‘a’ to ‘z’
Using a do while loop, output every character from ‘a’ to ‘z’. Put a space between each one and no line feeds.

7 Declare an integer num1 = 1000
Declare an integer num1 = Use a do while loop to keep asking for a number between Every time a number is entered, take that number and subtract it from num. Keep going until the value of num1 is less than 0.

8 Ask the user for three integer inputs and keep adding them together until you hit a number that can be evenly divided by 10. Each loop will add to the value of the previous loop. Let us know how many times you had to do the loop until you hit that number and what that number is.


Download ppt "More Loops."

Similar presentations


Ads by Google