Version without JavaScript, read-only: workshops, quizzes and running code are not available here. Full version · Catalogue · Sign in

Sequence

From 1 to 10 (do…while)

Core exercise

Write compterJusqua10() that prints the numbers from 1 to 10, one per line, with a do…while loop.

A workshop goes here: you write and run code in it. It requires JavaScript.

Starting code

Exercices.java

public class Exercices {

    public static void main(String[] args) {
        compterJusqua10();
    }

    public static void compterJusqua10() {
        // TODO : do { ... } while ( ... );
    }
}

The core exercise is validated in the workshop, which requires JavaScript.

Hint 1

Here the condition is tested at the end: the body is therefore always executed at least once. Compare with the while of the previous exercise.