fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner scanner = new Scanner(System.in);
  13. int n = scanner.nextInt();
  14. if(n < 0 || n%2 == 0){
  15. throw new IllegalArgumentException("Invalid Input value");
  16. }
  17. for(int i =0; i< n+2;i++){
  18. for(int j=0; j< n-1;j++){
  19. if(i==n+1){
  20. System.out.print("*");
  21. }else{
  22. System.out.print(" ");
  23. }
  24. }
  25. System.out.print("e");
  26. if(i == 0)
  27. for(int j=0; j< n+2;j++){
  28. System.out.print("*");
  29. }
  30. if(i == (n+2)/2)
  31. for(int j=0; j< n;j++){
  32. System.out.print("*");
  33. }
  34. System.out.println(" ");
  35. }
  36. }
  37. }
Success #stdin #stdout 0.18s 54576KB
stdin
3
stdout
  e***** 
  e 
  e*** 
  e 
**e