+ 2

Hello Everyone! I am unable to print patterns by using this code please help me.

https://code.sololearn.com/cdf9wqq8rQ58/?ref=app By running this code iam getting stars in one line but I want them in a form of a square.

15th May 2020, 4:51 PM
Laiba Jabeen
Laiba Jabeen - avatar
5 Antworten
+ 3
You are using println ,change that to print
15th May 2020, 4:59 PM
Abhay
Abhay - avatar
+ 3
I just noticed the question which asked that it was running in one line so print was missing there ,rest I was sure that would help them to figure out what else mistake they were doing :-)
15th May 2020, 5:08 PM
Abhay
Abhay - avatar
+ 2
You were almost there! There were two problems: (1) System.out.println always goes to a new line after printing. You should change this to System.out.print, which does not go to a new line after printing. (2) Your second print statement (the 'System.out.println()' piece) should be inside your outermost if statement, but it was actually outside of the if statement See the code below: https://code.sololearn.com/cftZoNe9bKnB/?ref=app
15th May 2020, 5:02 PM
DeX97
+ 2
Thank you so much 😊
15th May 2020, 5:04 PM
Laiba Jabeen
Laiba Jabeen - avatar
0
Abhay That's definitely the first issue, but there still is another one (see my response)
15th May 2020, 5:03 PM
DeX97