Write a program that displays the following pattern using nested for-loops.
REQUIREMENTS
· Your code must use nested for-loops.
· Your program should use only the following 3 output statements, one of EACH of the followings:
System.out.print("+"); // print +
System.out.print("-"); // print -
System.out.println(); // print a newline
· The user input is always correct (input verification is not required).
· Your code must work exactly like the following example (the text in bold indicates the user input).
Example of the program:
- Example 1:
Enter the number of rows: 3
The pattern is as follows:
++++++
++--++
+----+
+----+
++--++
++++++
- Example2:
Enter the number of rows: 6
The pattern is as follows:
++++++++++++
+++++--+++++
++++----++++
+++------+++
++--------++
+----------+
+----------+
++--------++
+++------+++
++++----++++
+++++--+++++
++++++++++++