Click here to Skip to main content
15,905,238 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to do a triangle with letter X with the number of length the user input. i did the triangle with the numbers.Example:
1
12
123
but i need to do with letter X, example:
X
XX
XXX

What I have tried:

int triangle = 3;
          System.out.println("You have entered '2' for 'Triangle'.");

          System.out.println("Please enter the length of the side:");

          int length =kb.nextInt();
          for(int row=1;row<=length;row++){

          }
Posted
Updated 13-Oct-22 16:40pm
v2

1 solution

It is exactly the same code as you already have. Just print the letter 'X' where you previously printed a number.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900