----------------------------------- Prince Fri Feb 06, 2004 10:59 am making diamonds ----------------------------------- i need help making the top part of a diamond... the purpose is to put in an odd integer (ex: 5) and it would print out a diamond... so if u put in 5 it would look like this: s***** ******* s***** ss*** sss* (the s is a space) the stuff under the line ive got, its the top im struggling on... any suggestions? import java.awt.*; import hsa.Console; public class Star { static Console c; public static void main (String [] args) { c = new Console (); int size = 0; int space = 1; do { c.println ("Enter an odd number between 1 and 25: "); size = c.readInt (); } while (size < 1 || size > 25); c.println (""); /* while (size>=1) { for (int a=1;a= 1) { for (int a = 1 ; a < space ; a++) c.print (" "); for (int b = 0 ; b < size ; b++) c.print ("*"); c.println (""); size -= 2; space++; } } } ----------------------------------- rizzix Fri Feb 06, 2004 3:32 pm ----------------------------------- here's a pseudocode, that sortof works: int w = 9; // width of diamond print repeat " " by w - ((w - 2) mod w); // might have to replace these print repeat "*" by (w - 2) * 2; // two lines with better code println; for (int i = w - 1; i >= 0; i--) { print repeat " " by w - (i mod w); print repeat "*" by i * 2; println; }