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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. System.out.println("Enter the value of n");
  14. int n=new Scanner(System.in).nextInt();
  15. if(n==1 || n%2==0){
  16. System.out.println("Please give only odd values");return;
  17. }
  18. for(int i=0;i<n+2;i++){
  19. for(int k=0;k<(3*n+6)/2-1;k++){
  20. System.out.print(" ");
  21. }
  22. System.out.println("e");
  23. }
  24. for(int i=0;i<n+2;i++){
  25. for(int k=0;k<n+2;k++){
  26. if(i==(n+2)/2)
  27. System.out.print("e");
  28. else
  29. System.out.print(" ");
  30. }
  31. for(int j=0;j<n;j++){
  32. System.out.print("*");
  33. }
  34. System.out.println();
  35. }
  36. }
  37. }
Success #stdin #stdout 0.19s 54540KB
stdin
5
stdout
Enter the value of n
         e
         e
         e
         e
         e
         e
         e
       *****
       *****
       *****
eeeeeee*****
       *****
       *****
       *****