Computer Science, asked by sahananm21, 5 months ago

[15]
Write a menu driven program using switch case in java to display the following structures.
(a) 1
2 3
5 6
7 8 9 10
11 12 13 14 15​

Answers

Answered by samhi71
1

import java.util.Scanner;

public class pattern

{

public static void main(String[] args) {

int i, j, k = 1;

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

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

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

}

System.out.println();

}

}

}

pls mark as brainliest

Similar questions