Question 7 of the pdf

I am having trouble of writing code to have 3 spaces continuously and then have the star again at the end

@piyushpunia2013_edbb5b6cbb8c0354 send me your code.

i was trying to use while loop but i learned that i have to use for loop for this problem after searching on the internet

import java.util.Scanner; public class pattern7 { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); //Outer Loop for number of Rows for(int i=0;i<n;i++) { // Inner loop for printing ‘’ in each column. for(int j=0;j<n;j++) { // For first row and last row we print '’ and for every other row we print the '’ at boundary region. if(i==0 || i==n-1 || j==0 || j==n-1) { System.out.print(" “); } // Otherwise we print blank space. else System.out.print(” "); } System.out.println(); } } }

is there a sollution for thi problem by using while loop ??

@piyushpunia2013_edbb5b6cbb8c0354 extremely for the late reply but the code you have sent is not in a readable form. Please upload your code in the below link and click file then click save.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.