Computer Science, asked by hueningkai906, 2 months ago

WAP in Java to display the following pattern:
1
12
123
1234
1 2 3 4 5

Answers

Answered by kajalpal1975
1

Answer:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

int i, j;

for (i = 1; i <= 5; i++) {

for (j = 1; j <= i; j++) {

System.out.print(j + " ");

}

System.out.println();

}

}

}

Similar questions