Advertisement
JeffGrigg

Optimized2

Dec 12th, 2018
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.41 KB | None | 0 0
  1. public class Optimized2 {
  2.     public static void main(String[] args) {
  3.         int size = 9;
  4.         for (int i = 1; i <= size; i++) {
  5.             for (int j = 1; j <= size * 2 - 1; j++) {
  6.                 System.out.print((i > 1 && size > i && ((i * 2 - 1 == j) || size * 2 - i * 2 + 1 == j) || j % 2 == 0)
  7.                         ? ' ' : '*');
  8.             }
  9.             System.out.println();
  10.         }
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement