Information technology
Nested for Loops
What output is produced by the following program?
public class Loops { OUTPUT
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
for (int j = 1; j < i; j++) {
System.out.print(” “);
}
for (int j = 1; j <= 21 – 2 * i; j++) {
System.out.print(“*”);
}
System.out.println();
}
}
}
Write a static method named drawFigure that produces the following output. Use for loops to capture the structure of the figure.
////////\\\\
//////****\\\
////********\\
//************\
****************
Modify your method from the previous exercise so that it uses a class constant for the figure’s size. The previous output used a constant size of 5. Here is the output for a constant size of 3:
////\\
//****\
********
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


