So I did the first part of my assisgnment like this
*
**
***
****
*****
******
*******
********
*********
using this code

public class starForTest
{
	public static void main(String [] args)
	{
		for (int i=1; i<=9; i++)
		{
			System.out.println();
			for (int j=9; j>=i; j--)
			{
				System.out.print(" ");
			}
		 for (int k=1; k<=i; k++)
		 {
		 	System.out.print("*");
		 }	
	            }
	System.out.println();	
	}
}

but now i need to flip it to make it look like this
*****
****
***
**
*
but i dont't know how.

Recommended Answers

All 3 Replies

Do you just want 123456789987654321?

for (int i=1; i<=9; i++){	
   System.out.println("i"+i);
}		

for (int j=9; j>=i; j--){						
   System.out.println(j"+j);
}

But there's probably a more expert way of doing this...

I have to use the " * "

Think about how the first program controls how many * it prints on a line. It starts at one and moves on to a max number.
Now rework the logic so it starts at the max number and works done to one.

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.