I can't get my diamond to look like this:
*
***
*****
*******
*********
***********
*********
*******
*****
***
*
Mines look like this:
*
***
*****
*******
*********
**********
********
******
****
**
The top part I got right, but the bottom of the diamond is wrong, and I don't know why. But when I try to do even numbers it comes out perfectly. But odd numbers are wrong.
CODE
int num = keybd.nextInt();
for (int row = 0; row <= num/2; row++) {
for (int col = 1; col <= (num/2) - row; col++)
System.out.print(" ");
for (int mid = 1; mid <= (row*2) - 1; mid++)
System.out.print("*");
System.out.println();
}
for (int row = 1; row <= (num/2); row++) {
for (int col = 1; col <= row - 1; col++)
System.out.print(" ");
for (int mid = 1; mid <= num - (row*2) + 1; mid++)
System.out.print("*");
System.out.println();
}
}
}