martinvalchev

Triangle of Dollars

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