fork download
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. public class Main
  10. {
  11. public static void main(String[] args) {
  12. System.out.println("Hello World");
  13.  
  14. int n =8;
  15.  
  16. if( n<=1 || n%2==0){
  17. System.out.println("This is not allowed");
  18.  
  19. }else{
  20.  
  21.  
  22. //outer loop
  23. for(int i=0;i<n+2;i++){
  24.  
  25. for(int sp=0;sp<n-1;sp++){
  26. if(i==n+1 ){
  27. System.out.print("*");
  28. }else{
  29. System.out.print(" ");
  30. }
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37. for(int j=0;j<n;j++){
  38. if(j==n-1){
  39. System.out.print("e");
  40. }
  41.  
  42. }
  43.  
  44.  
  45. for(int st =0;st<2*n+2;st++){
  46.  
  47. if(i==0 && st>=n ){
  48. System.out.print("*");
  49. }
  50.  
  51. if(i==n/2+1 && st>n+1){
  52. System.out.print("*");
  53. }
  54.  
  55. }
  56.  
  57. System.out.println("");
  58. }
  59.  
  60.  
  61. // 2nd outer loop
  62.  
  63. // for(int i=0;i<n+2;i++){
  64.  
  65. // for(int sp=0;sp<2*n-1;sp++){
  66. // if(i==n+1 ){
  67. // System.out.print("*");
  68. // }else{
  69. // System.out.print(" ");
  70. // }
  71.  
  72. // }
  73.  
  74. // for(int j=0;j<n;j++){
  75. // if(j==n-1){
  76. // System.out.print("e");
  77. // }
  78.  
  79. // }
  80.  
  81. // System.out.println("");
  82. // }
  83. }
  84. }
  85. }
  86.  
Success #stdin #stdout 0.08s 52572KB
stdin
Standard input is empty
stdout
Hello World
This is not allowed