I got other version of that program that asks the user the high of the triangle, and the symbol that he/she wants to use to print the triangle, I also wrote a simple menu
just to show;
public class Triangle { public static void main(String[] args) { Scanner input = new Scanner (System.in); int optiona =0; do{ optiona = optiona(); switch (opcao){ case 0: System.exit() break; case 1: System.out.println("Insert the tringle's high :"); int high = input.nextInt(); System.out.println(); System.out.println("Insert the triangle's symbol :"); char symbol = input.next().charAt(0); for (int l=1; l <= altura; l++ ){ printSequence(high-l,' '); printSequence(2*l-1,symbol); System.out.println(); } break; }while(opcaoa != 0); } /** * Prints in the screen a sequence with n copys of c * @param n size of the sequence * @param c character of the sequence */ public static void printSequence(int n, char c) { for (int i=1; i <= n; i++ ) System.out.print(c); } public static int optiona(){ //Prints the menu until the option is valid int optiona =0; do{ Scanner input = new Scanner (System.in); System.out.println("Choose an option:"); System.out.println(" 0 - Exit"); System.out.println(" 1 - Create triangle"); opcaoa = input.nextInt(); if (optiona <0 || optiona >1) // verify if the option is valid System.out.println("Invalid option!, please choose another option"); }while(optiona <0 || optiona>1); return optiona; } } Sorry if something wrong, and hope some comments (new in forum, and still getting used to it)