Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PrintTriangle2
- {
- public static void main(String[] args)
- {
- int n = 6;
- char symbol = '*';
- for (int row = n; row > 0; row--) { // this loop makes 6 rows.
- for (int emptySpace = row; emptySpace < n; emptySpace++) { // this loop makes empty spaces for row 6 ,5 empty space and so on.
- System.out.print(" ");
- }
- for (int col = 1; col <= row; col++) { // this loop makes the columns their are equal to the rows
- System.out.print(symbol);
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement