Learn C Programming

Lesson 3 of 9 · Loops and Jump Statements

Module 6 · Loops and Jump Statements

do while: the Loop That Runs at Least Once

Free with an accountReading

Maria's till asks for a quantity, and it has to ask at least once. There is nothing to check until somebody types a number. It also has to refuse 0, because a quantity of 0 is not an order. It is a customer who changed their mind at the counter.

Checking what this lesson needs for you…

What is inside do while: the Loop That Runs at Least Once

  1. do while: the body first, the question after
  2. The semicolon after while
  3. Zero passes or one: the same false condition in both loops
  4. Asking until the answer is valid
  5. Clearing a bad line, and stopping when input ends
  6. A menu that runs until 0
  7. while or do while?