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.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. // // your code goes here
  15. int n=5;
  16. // if(n%2==0){
  17. // System.out.println("enter the prime number");
  18.  
  19. // }
  20. // else{
  21.  
  22. for(int i=1;i<=n+2;i++){
  23. for(int j=1;j<n/2;j++){
  24. System.out.print("e");
  25. }}
  26. int k = 0;
  27.  
  28. for (int i = 1; i <= n; ++i, k = 0) {
  29. for (int s = 1; s<= n - i; ++s) {
  30. System.out.print(" ");
  31. }
  32.  
  33. while (k != 2 * i - 1) {
  34. System.out.print("* ");
  35. ++k;
  36. }
  37.  
  38. System.out.println();
  39. }
  40. }
  41.  
  42. }
Success #stdin #stdout 0.09s 54624KB
stdin
Standard input is empty
stdout
eeeeeee        * 
      * * * 
    * * * * * 
  * * * * * * * 
* * * * * * * * *