desislava_topuzakova

08. Triangle of Numbers

Sep 17th, 2022
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TriangleOfNumbers_08 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner (System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.  
  8.         for (int row = 1; row <= n ; row++) {
  9.             //колко пъти да печатам нещо
  10.             for (int count = 1; count <= row ; count++) {
  11.                 System.out.print(row + " ");
  12.             }
  13.             System.out.println();
  14.  
  15.         }
  16.     }
  17. }
Add Comment
Please, Sign In to add comment