+ 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.
5 Answers
+ 3
You are using println ,change that to print
+ 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 :-)
+ 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
+ 2
Thank you so much đ
0
Abhay That's definitely the first issue, but there still is another one (see my response)