While + Counter - Practice Exercises Java Lesson 2: Flow Control Exercise 2.8: while + Counter Objetive: Create a Java program to display the numbers 1 to 10 on screen, using "while". Source Code: JAVA C# public class Main { public static void main(String[] args) { int n = 1; while (n <= 10) { System.out.printf("%1$s ", n); n++; } } } Copy Exercise to ClipBoard Copy Code to ClipBoard Exercisey 2.8
More exercises for Lesson 2 << Previous 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Next >>