Didart

Triangle Of Numbers

Sep 20th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package src;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TriangleOfNumbers {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.        
  9.         int n = Integer.parseInt(scanner.nextLine());
  10.  
  11.         for (int i = 1; i <= n; i++) {
  12.             for (int j = 1; j <=i ; j++) {
  13.                 System.out.print(i + " ");
  14.             }
  15.             System.out.println();
  16.         }
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment