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. int n = 3;
  13. if (n <= 1 || n%2 == 0) {
  14. System.out.print("Please enter value greater than 1 and must be odd");
  15. return;
  16. }
  17.  
  18. for (int i = 1; i <= 2*n+1; i++) {
  19.  
  20. //Part 1
  21. if (i>= 1 && i<= n+1) {
  22. for (int j = 1; j <= 2*n-1; j++) {
  23. System.out.print(" ");
  24. }
  25. for (int j = 1; j <= 1; j++) {
  26. System.out.print("e");
  27. }
  28. System.out.println();
  29. }
  30.  
  31. //Part 2
  32. if (i == n+2) {
  33. for (int j = 1; j <= n-2; j++) {
  34. System.out.print(" ");
  35. }
  36. for (int j = 1; j <= n+2; j++) {
  37. System.out.print("e");
  38. }
  39. System.out.println();
  40. }
  41.  
  42. //Part 3
  43. if (i == n+4) {
  44. for (int k = 2; k <= n; k++) {
  45. for (int j = n-k; j >= 1; j--) {
  46. System.out.print(" ");
  47. }
  48. for (int j = 1; j <= 2*k-n; j++) {
  49. System.out.print("@");
  50. }
  51. System.out.println();
  52. }
  53. }
  54. }
  55. }
  56. }
Success #stdin #stdout 0.07s 52640KB
stdin
Standard input is empty
stdout
     e
     e
     e
     e
 eeeee
 @
@@@