Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using for loop, while loop, or do while loop to print a squarewhich has a 10x10

ID: 3617899 • Letter: U

Question

Using for loop, while loop, or do while loop to print a squarewhich has a 10x10 line of *except, line 8 consisting of # insteadof * (hint write a simple if statment within the loop) Final output should look like this: ********** ********** ********** ********** ********** ********** ********** ########## ********** ********** Using for loop, while loop, or do while loop to print a squarewhich has a 10x10 line of *except, line 8 consisting of # insteadof * (hint write a simple if statment within the loop) Final output should look like this: ********** ********** ********** ********** ********** ********** ********** ########## ********** **********

Explanation / Answer


import java.util.*;
public class stars { public static void main(String args[]) { for(int v=1;v<11;v++) { if(v%8==0) { for(int a=1;a<=10;a++) System.out.print("#"); } else { for(int a=1;a<=10;a++) System.out.print("*"); } System.out.println(); } } }
import java.util.*;
public class stars { public static void main(String args[]) { for(int v=1;v<11;v++) { if(v%8==0) { for(int a=1;a<=10;a++) System.out.print("#"); } else { for(int a=1;a<=10;a++) System.out.print("*"); } System.out.println(); } } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote