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
English,
3 months ago
Science,
3 months ago
Science,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Geography,
1 year ago