Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ReverseTriangleToRight {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Please enter the size of the triangle base: ");
- int base = sc.nextInt();
- for(int i = base; i > 0; i--) { // Each iteration draws a different line
- for(int j = 0; j < base - i; j++) { // A loop for printing the spaces in a row
- System.out.print(" ");
- }
- for(int j = 0; j < i; j++) { // A loop for printing the astrixes in a row
- System.out.print("*");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement