Question: Write a program named PlusSigns.java that asks the user for a number from 1-10 and then prints an inverted triangle of plus signs. For example,
Write a program named PlusSigns.java that asks the user for a number from 1-10 and then prints an inverted "triangle of plus signs".
For example, an input of 6 would produce this output:
+++++++++++
+++++++++
+++++++
+++++
+++
+
Hint: Make a table that tells how many leading spaces and plus signs you'll need:
row #plus signs #spaces
+++++++++++ 0 11 0
+++++++++ 1 9 1
+++++++ 2 7 2
+++++ 3 5 3
+++ 4 3 4
+ 5 1 5
Then use that to figure out formulas that, given a row number, will tell you how many spaces and plus signs you need to print in the inner loop.
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
Program import javautilScanner class PlusSigns public static v... View full answer
Get step-by-step solutions from verified subject matter experts
