fork(3) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. class M{
  4. static String c(int n){
  5. String r = "";
  6. for(int i = n, j; i-- > 0; r += "\n"){
  7. for(j = 0; j < n;
  8. r += i*j < 1 | n-i < 2 | n-j < 2 | i == j | i == n-++j
  9. ? "*"
  10. : " ");
  11. }
  12. return r;
  13. }
  14.  
  15. public static void main(String[] a){
  16. System.out.println(c(1));
  17. System.out.println(c(3));
  18. System.out.println(c(5));
  19. System.out.println(c(6));
  20. System.out.println(c(7));
  21. }
  22. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
*

***
***
***

*****
** **
* * *
** **
*****

******
**  **
* ** *
* ** *
**  **
******

*******
**   **
* * * *
*  *  *
* * * *
**   **
*******