View Single Post
  #3 (permalink)  
Old 07-30-2007, 02:58 PM
cruxblack cruxblack is offline
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Hmm, why don't u try defining the borders for each side first before u make the code?
It'll be easier u know

Btw, the fault u got in ur code was the println(" "), thats why it creates a gap that eventually became smaller as ur code reach its end, try do a logic simulation of the code in ur notepad, ull see whats wrong, at 1st its gonna print about 10 or 11 lines first before putting a *, havent count it yet

Code:
public class exercise { public static void main(String[] args) { for (int i = 1; i <=6 ; i++) //i = coordinate x { space = 6-i; //the amount of space needed for (int j = 1; j <= space ; j++) // j = coordinate y { System.out.println(" "); } System.out.println("*"); } } }
Hope this helps
Reply With Quote