Write a program (Using scanner class) to generate a pattern of a token / word in the
form of a traiangle or in the form of an inverted triangle depending upon the user’s
choice.
Sample input : Enter a word as a token
CLASS
Sample output:
Enter your choice: 1
C
C L
C L A
C L A S
C L A S S
Enter your choice: 2
C L A S S
C L A S
C L A
C L
C
Answers
Answered by
6
Answer:
Write a program to generate a triangle or an inverted triangle till n terms based upon the user’s choice of triangle to be displayed. Example 1: Input : Type 1 for a triangle and Type 2,for an inverted triangle 1 Enter the number of terms 5 Output : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 Example 2: Input : Type 1 for a triangle and Type 2 for an inverted triangle 2 Enter the number of terms 6 Output : 6 6 6 6 6 6 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1Read more on Sarthaks.com - https://www.sarthaks.com/840751/program-generate-triangle-inverted-triangle-terms-based-users-choice-triangle-displayed
Explanation:
pls mark as a brainlist pls
Similar questions