Hi. I've beed trying to do this for days but I can't.
I got the program to do the whole diamond but I don't know how to take out all the asterisk. żAny idea?
This is my code:
public class diamond { public static void main(String args[]) { int i=0,j,k,n=4; for(k=1;k<=n;k++) { for(i=0;i<=n-k;i++) { System.out.print(" "); } for(j=1;j<=k;j++) { System.out.print("*"); } for(j=1;j<=k-1;j++) { System.out.print("*"); } System.out.println(""); } for(k=1;k<=n;k++) { for(i=0;i<=k;i++) { System.out.print(" "); } for(i=1;i<=n-k;i++) { System.out.print("*"); } for(j=0;j<=n-k-2;j++) { System.out.print("*"); } System.out.print("\n"); } } }