Shavit

Ex. Bank #17

Nov 26th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. // Shavit Borisov
  2. // HW
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class TriangleDrawer {
  7.  
  8.     public static void main(String[] args)
  9.    
  10.     {
  11.         Scanner in = new Scanner (System.in);
  12.        
  13.         int size;
  14.        
  15.         System.out.print("Enter the size of your triangle's side: ");
  16.         size = in.nextInt();
  17.        
  18.         for(int i = 1; i <= size; i++)
  19.         {
  20.             int j;
  21.             for(j = 1; j < size + 1 - i; j++)
  22.                 System.out.print(" ");
  23.             j--;
  24.             for(int k = 1; k < size + 1 - j; k++)
  25.                 System.out.print("* ");
  26.             System.out.println();
  27.         }
  28.         in.close();
  29.     }
  30. }
Add Comment
Please, Sign In to add comment