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. Scanner sc = new Scanner(System.in);
  13. int n = sc.nextInt();
  14. if(n % 2 == 0){
  15. System.out.print("Ivalid input it should always odd number");
  16. return;
  17. }
  18. for(int i = 0 ; i < n / 2; i++){
  19. for(int j = 0; j < n + 1; j++){
  20. System.out.print(" ");
  21. }
  22. for(int j = 0; j < n /2 ; j++){
  23. if( j >= n/2 - 1 - i){
  24. System.out.print("*");
  25. }
  26. else{
  27. System.out.print(" ");
  28. }
  29. }
  30. System.out.println();
  31. }
  32. for(int i = 0 ; i < 2 * n + n / 2 + 1; i++){
  33. if(i < n || i > n + n / 2){
  34. System.out.print("e");
  35. }else{
  36. System.out.print("*");
  37. }
  38. }
  39. System.out.println();
  40. for(int i = 0; i < n / 2 ;i++){
  41. for(int j = 0; j < 2 * n + n / 2 + 1;j++){
  42. if(j == 0 || j == 2 * n + n / 2){
  43. System.out.print("e");
  44. }else if(j >= n + 1 + i && j <= n + n / 2){
  45. System.out.print("*");
  46. }
  47. else{
  48. System.out.print(" ");
  49. }
  50. }
  51. System.out.println();
  52. }
  53. for(int i = 0; i < n / 2 + 1;i++){
  54. for(int j = 0; j < 2 * n + n / 2 + 1;j++){
  55. if(j == 0 || j == 2 * n + n / 2){
  56. System.out.print("e");
  57. }else{
  58. System.out.print(" ");
  59. }
  60.  
  61. }
  62. System.out.println();
  63. }
  64.  
  65. // your code goes here
  66. }
  67. }
Success #stdin #stdout 0.13s 55072KB
stdin
11
stdout
                *
               **
              ***
             ****
            *****
eeeeeeeeeee******eeeeeeeeeee
e           *****          e
e            ****          e
e             ***          e
e              **          e
e               *          e
e                          e
e                          e
e                          e
e                          e
e                          e
e                          e