ICSE Class 10 Computer Applications Question 14 of 22

Nested for loops — Question 14

Back to all questions
14
Question

Question 4

Write a program to print the series given below.

8 88 888 8888 88888 888888

public class Kboat8Series
{
    public static void main(String args[]) {
        
        for (int i = 1; i <= 6; i++) {
            for (int j = 0; j < i; j++) {
                System.out.print('8');
            }
            System.out.print(' ');
        }
    }
}
Output
BlueJ output of Kboat8Series.java
Answer