Write a java program to display the following series :
1
1 2
1 2 3
1 2 3 4
Answers
Answered by
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
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
CBSE BOARD XII,
2 months ago
English,
2 months ago
Science,
4 months ago
Math,
4 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
Geography,
10 months ago