Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // HW
- import java.util.Scanner;
- public class TriangleDrawer {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- int size;
- System.out.print("Enter the size of your triangle's side: ");
- size = in.nextInt();
- for(int i = 1; i <= size; i++)
- {
- int j;
- for(j = 1; j < size + 1 - i; j++)
- System.out.print(" ");
- j--;
- for(int k = 1; k < size + 1 - j; k++)
- System.out.print("* ");
- System.out.println();
- }
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment