Write a java program to print following pattern:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
plz help.
Answers
Answered by
0
Answer:
654321..............
Answered by
1
Question:-
Write a Java program to print the following pattern.
1
21
321
4321
54321
Program:-
Here is your program written in Java.
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 for the pattern: ");
int n=sc.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=i;j>=1;j--)
System.out.print(j+ " ");
System.out.println();
}
}
}
Similar questions
Math,
3 months ago
Accountancy,
3 months ago
Math,
3 months ago
Political Science,
7 months ago
Math,
7 months ago
Chemistry,
11 months ago