Advertisement
desislava_topuzakova

04.TriangleOfDollars

May 27th, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TriangleOfDollars {
  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 = 0; row < n ; row++) {
  9.             System.out.print("$");
  10.             for (int col = 0; col < row ; col++) {
  11.                 System.out.print(" $");
  12.             }
  13.             System.out.println();
  14.         }
  15.  
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement