Computer Science, asked by Anonymous, 4 months ago

Write a java program to display the following series :
1
1 2
1 2 3
1 2 3 4

Answers

Answered by anindyaadhikari13
2

Question:-

Write a java program to display the following pattern.

1

1 2

1 2 3

1 2 3 4

Program:-

import java.util.*;

class Pattern

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the number of rows: ");

int r=sc.nextInt();

for(int i=1;i<=r;i++)

{

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

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

System.out.println();

}

}

}

Answered by BrainlyProgrammer
1

Answer:

Question: to print in java

1

12

123

1234

Code:

for(I=1;I<=4;I++)

{

for (j=1;j<=I;j++)

{

System.out.println(j)

}

}

Similar questions