Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OptimizeThis {
- public static void main(String[] args) {
- int size = 9;
- for (int i = 1; i <= size; i++) {
- for (int j = 1; j <= size * 2 - 1; j++) {
- if (i > 1 && size > i && ((i * 2 - 1 == j) || size * 2 - i * 2 + 1 == j)) {
- System.out.print(" ");
- } else if (j % 2 == 0) {
- System.out.print(" ");
- } else {
- System.out.print("*");
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement