Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. class test
  2. {
  3. public static void main(String args[])
  4. {
  5. System.out.print("Poso megalo se ipsos: ");
  6.  
  7. int ipsos = UserInput.getInteger();
  8. int rows = 1, stars = 1, platos = ipsos + (ipsos + 1);
  9.  
  10. System.out.println();
  11.  
  12. while(ipsos >= rows)
  13. {
  14. for(int i = 0; i < platos; i++)
  15. {
  16. /*if(i > (platos / 2) - stars && i < (platos / 2) + stars)
  17. {
  18. System.out.print("*");
  19. }
  20. else
  21. {
  22. System.out.print(" ");
  23. }*/
  24.  
  25. System.out.print((i > (platos / 2) - stars && i < (platos / 2) + stars) ? "*" : " ");
  26. }
  27.  
  28. System.out.println();
  29.  
  30. rows++;
  31. stars++;
  32. }
  33.  
  34. for(int j = 0; j < 2; j++)
  35. {
  36. for(int k = 0; k < platos; k++)
  37. {
  38. /*if(k >= (platos / 2) - 1 && k <= (platos / 2) + 1)
  39. {
  40. System.out.print("*");
  41. }
  42. else
  43. {
  44. System.out.print(" ");
  45. }*/
  46.  
  47. System.out.print((k >= (platos / 2) - 1 && k <= (platos / 2) + 1) ? "*" : " ");
  48. }
  49.  
  50. System.out.println();
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement