fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.util.Scanner;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // Scanner in = new Scanner();
  14.  
  15. // system.out.print("Please Enter the number here :");
  16.  
  17. // int n = in.nextInt(System.in);
  18.  
  19. int n = 3;
  20. int b = 0;
  21.  
  22. if(n == 3){
  23. b = 2;
  24. }
  25.  
  26. if(n == 5){
  27. b = 3;
  28. }
  29.  
  30. if(n == 7){
  31. b = 4;
  32. }
  33.  
  34. if(n == 9){
  35. b = 5;
  36. }
  37.  
  38. if(n == 11){
  39. b = 6;
  40. }
  41.  
  42. if(n == 13){
  43. b = 7;
  44. }
  45.  
  46. if(n == 1){
  47. System.out.println("input 1 is not allowed");
  48. }
  49.  
  50. boolean state = true;
  51.  
  52. for(int i = 2 ; i < n ; i++){
  53. if(n%i == 0){
  54. state = false;
  55. }
  56. }
  57.  
  58. if(state == false){
  59. System.out.println("Number is even please enter the odd number only except 1");
  60. }
  61.  
  62. for(int i = 1 ; i <= n+2-b ; i++){
  63.  
  64. for(int j = 1 ; j<= (n*2-1) ; j++){
  65. System.out.print("g");
  66.  
  67. }
  68. System.out.print("e");
  69. System.out.println();
  70.  
  71. }
  72.  
  73. }
  74. }
Success #stdin #stdout 0.08s 52672KB
stdin
Standard input is empty
stdout
ggggge
ggggge
ggggge