Advertisement
psi_mmobile

Untitled

Aug 27th, 2022
1,350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. public class MyClass {
  2.     public static void main(String args[]) {
  3.         java.util.Scanner scanner = new java.util.Scanner(System.in);
  4.         int input = Integer.valueOf(scanner.nextLine());
  5.         while (!(input >= 1 && input <= 20)) {
  6.             input = Integer.valueOf(scanner.nextLine());
  7.         }
  8.         for(int i = 1; i <= input;i++) {
  9.             for(int j = 0; j < i; j++) {
  10.                 System.out.print(i + " ");
  11.             }
  12.             System.out.print("\n");
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement