- Home
- Geometric shapes
- Triangle Rectangle String

Tuesday, October 31, 2023
⁃
Difficulty:
Intermediate

Write a Java program that prompts the user for a text string `x`

and draws a right triangle like the output of the example.

The first row of the triangle is the last letter of the text, and the last row of the triangle is the entire text.

The height of the triangle will always be the total number of characters of the text requested from the user.

triangle

e le gle ngle angle iangle riangle triangle

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

The code has been successfully copied to the clipboard.

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

Practice with exercises in Java to create geometric shapes of different types.