Complete these two patterns in program using nested Loops for each. You MUST use nested loops in this one. You are demonstrating how to use loops to make a pattern.
Pattern 1
&
&&
&&&
&&&&
&&&&&
Pattern 2
&&&&&
&&&&
&&&
&&
&
Use introductory level Java to solve this and NetBeans 8.0
public class PrintPatterns { public static void main(String[] args) { System.out.println("Pattern 1"); for (int i = 1; i <= 5; i++) { for (int j = 0; j < i; j++) { System.out.print("&"); } System.out.println(); } System.out.println("Pattern 2"); for (int i = 5; i >= 1; i--) { for (int j = 0; j < i; j++) { System.out.print("&"); } System.out.println(); } } }
Get Answers For Free
Most questions answered within 1 hours.