+ 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
4 Answers
+ 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
+ 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();
}
}
}
0
nAutAxH AhmAd do according to my program as i want to make d program small????
0
Dan Walker thnku so much!!!!!!!!!!