i am trying to make this shape using java
**********************
**********************
*****************
***************
************
***************
******************
i have TRIED at the bottom as u can see but i am unable to get this shape
i am confused

public class courseforuni 
{
	public static void main (String [] args)
	{
		int a=5;
		for(int i=0; i<=a; i++)
		{
			for(int j=0; j<=a; j++)
			{
				if((i+j)<=a)
				{
					System.out.println ("*");
				}
				else
				{
					System.out.print("");
				}
			}
			System.out.print ("");

Next time wrap your code in code tags and properly indent it

You should make an inner loop work according the number showing at the outer loop
Pseudo:

for(int i=0;i<7;i++){   //outer loop
    if(i==0 ||  i==1){                    //condition used to tell which loop to use
       for(int j=0;j<numberofstars;j++){  //inner loop used to print *
           System.out.print("*");
           }
       System.out.print("\n");   //just to show a newline
    }
    else if(i == 3){
         for(int j=0;j<anothernumberofstars;j++){
           System.out.print("*");
         }
          System.out.print("\n");   
    }
    //repeat steps for all iterations
}

Next time wrap your code in code tags and properly indent it

You should make an inner loop work according the number showing at the outer loop
Pseudo:

for(int i=0;i<7;i++){
    if(i==0 ||  i==1){
       for(int j=0;j<numberofstars;j++)
           System.out.print("*");
    }
    else if(i == 3){
         for(int j=0;j<anothernumberofstars;j++)
           System.out.print("*");
    }
    //repeat steps for all iterations
}

um thanks
i tried doing this program but whenever i put in for(int j=0;j<numberofstars;j++) i got number of stars underlined red which means wrong for(int j=0;j<anothernumberofstars;j++); i got another number of stars underlined in red and it said another number of stars cannot be resolved to a variable
}

It's only a code snippet and not complete its your job to change those variables to a number you want

I'm only showing it as a guide not as an answer

what do u mean repeat steps for all literations

what do u mean repeat steps for all literations

do a condition when "i" is equal to 4,5,6, etc
where each condition's inner loop is used to print a specific nuber of "*"

do a condition when "i" is equal to 4,5,6, etc
where each condition's inner loop is used to print a specific nuber of "*"

i dont get it ????

i dont get it ????

else if(i == 4){
//another loop which prints a different number of  * 
}
else if(i == 5){
//another loop which prints a different number of  * 
}
//do this until all values of i is covered
else if(i == 4){
//another loop which prints a different number of  * 
}
else if(i == 5){
//another loop which prints a different number of  * 
}
//do this until all values of i is covered

so what number do i go tilll

till the last iteration of "i" (the outer loop counter)
in my example it's 6

Isn't it your job to manipulate your own code?

till the last iteration of "i" (the outer loop counter)
in my example it's 6

Isn't it your job to manipulate your own code?

thats all right

uh huh thats all i have to do

If you have no more questions mark this thread as solved otherwise just ask

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.