+ 2

How can we arrange this pattern..??[SOLVED]

Can anyone help me please... I just want to print multiplication table. my code is correct to print those numbers .but , problem is cannot print like square because of double digits .. 🙄 .please help me out from this problem.. suggestions are welcome .. Thank you.. https://code.sololearn.com/cqOTWXL66W4V/?ref=app

19th Feb 2021, 4:56 PM
❤☆Nani☆❤
❤☆Nani☆❤ - avatar
8 Respuestas
+ 4
// this should give you 'square' output format: System.out.print(" "+(9<x ? "" : " ")+x);
19th Feb 2021, 5:06 PM
visph
visph - avatar
+ 4
System.out.printf("%3d ",x);
19th Feb 2021, 5:10 PM
JaScript
JaScript - avatar
+ 1
visph JaScript thank you both..😊
19th Feb 2021, 5:19 PM
❤☆Nani☆❤
❤☆Nani☆❤ - avatar
+ 1
visph your answer Is helped me alot .. JaScript thanks for answering. In last line 90 and 100 was joined . It's doesn't have a space .
19th Feb 2021, 5:23 PM
❤☆Nani☆❤
❤☆Nani☆❤ - avatar
+ 1
"%4d" instead of "%3d"
19th Feb 2021, 5:24 PM
visph
visph - avatar
+ 1
visph done 👍😊
19th Feb 2021, 5:25 PM
❤☆Nani☆❤
❤☆Nani☆❤ - avatar
0
JaScript not really: only last line (table of 10) has once 3 digits number, at last position (100), so square is preserved ;P
19th Feb 2021, 5:18 PM
visph
visph - avatar
0
JaScript also, yours should be "%4d" ^^ ♡Nani《 King Of Pain 》♡ for JaScript solution you need to use printf instead of print ^^
19th Feb 2021, 5:21 PM
visph
visph - avatar