Computer Applications

Write a program in Java to print the series:

8, 88, 888, 8888, 88888, 888888

Java

Java Nested for Loops

30 Likes

Answer

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

Answered By

12 Likes