Plzz fix my this pattern in this program!!!!! | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Plzz fix my this pattern in this program!!!!!

plzzzz give some suggestion a a a a a a a a a a a. a. a. a. a a. a. a. a a. a. a a. a a I try this but there is some problem https://code.sololearn.com/cEBGEP8q0K3U/?ref=app ‎ ‏‏‎Sreejith  Purab Gupta [A^dr3w] Dan Walker Dev Hans Larry Helga HAWKEYE Fata1 Err0r Arun Tomar

17th Aug 2018, 6:48 AM
Harsh Agrawal
Harsh Agrawal - avatar
4 Réponses
+ 2
Harsh Agrawal change the space - i to Math.abs(space - i) After the 5th line we no longer enter that loop because the exit condition is satisfied before we enter the loop
18th Aug 2018, 8:00 AM
Dan Walker
Dan Walker - avatar
+ 4
public class Program { public static void main(String[] args) { int i,j,space=5; for(i=1;i<=5;i++) { for(j=1;j<=space-i;j++) { System.out.print(" "); } for(j=1;j<=i;j++) { System.out.print("a "); } System.out.println(); } space = 4; for(i = 4; i >= 1; i--) { for(j=i; j<=space; j++) { System.out.print(" "); } for(j=i; j>=1; j--) { System.out.print("a "); } System.out.println(); } } }
17th Aug 2018, 7:39 AM
blACk sh4d0w
blACk sh4d0w - avatar
0
nAutAxH AhmAd do according to my program as i want to make d program small????
17th Aug 2018, 7:40 AM
Harsh Agrawal
Harsh Agrawal - avatar
0
Dan Walker thnku so much!!!!!!!!!!
18th Aug 2018, 8:09 AM
Harsh Agrawal
Harsh Agrawal - avatar