write a program in java to print this series.
1
21
321
4321
54321
Answers
Answered by
15
import java.util.Scanner;
public class Pattern {
public static void printPattern(int n) {
for (int i = 1; i <= n; i++) {
for (int j = i; j >= 1; j--) {
System.out.print(j + " ");
}
System.out.println();
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
int n = scanner.nextInt();
printPattern(n);
}
}
public class Pattern {
public static void printPattern(int n) {
for (int i = 1; i <= n; i++) {
for (int j = i; j >= 1; j--) {
System.out.print(j + " ");
}
System.out.println();
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
int n = scanner.nextInt();
printPattern(n);
}
}
Answered by
30
Hey frnd ❤️❤️
hope helps yu✌️✌️✌️
pls refer to the attachment nd mark brainliest answer✌️✌️✌️✌️❤️
#Abhipsa❤️
Attachments:
Similar questions