How do you center a pyramid figure in Javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you center a pyramid figure in Javascript

Hello I have to print this statement (Seen below), and my code is correct in doing it BUT I can not get it to center directly down the middle! 1 212 32123 4321234 543212345 ---------------------------------------------------------My Code: public class pyramid { public static void main(String []args){ for(int i=1; i<=7 ; i++) { for(int j=i; j>=2; j--) { System.out.print(j); } for(int j=1; j<=i; j++) { System.out.print(j); } System.out.println(" "); } } }

15th Mar 2017, 11:51 PM
Nick Yesu
Nick Yesu - avatar
1 Answer
0
Heres what my program printsvexactly as so: 1 212 32123 4321234 543212345 65432123456 7654321234567
15th Mar 2017, 11:52 PM
Nick Yesu
Nick Yesu - avatar