Write a program to display the given pattern:
3
5 6
8 9 10
12 13 14 15
Answers
Answered by
4
Question:-
➡ Write a program in Java to display the following pattern.
3
5 6
8 9 10
12 13 14 15
Program:-
This is the shortest approach.
class Main
{
public static void main(String s[])
{
int a=3;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
System.out.print(a++ + " ");
a++;
System.out.println();
}
}
}
For verification, check out the attachment.
Attachments:
Similar questions
Psychology,
5 months ago
India Languages,
5 months ago
Art,
10 months ago
Math,
10 months ago
Hindi,
1 year ago