Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class hourglass {
  2. public static void main(String[] args) {
  3. int spaces = 0;
  4. int start = 15;
  5. int stars = start;
  6. for (int one = start; one > 0; one--) {
  7. if (one > start/2)
  8. spaces = start - one;
  9. else
  10. spaces--;
  11. for (int two = spaces; two > 0; two--)
  12. System.out.print(" ");
  13. for (int three = stars; three > 0; three--)
  14. System.out.print("*");
  15. if (one > start/2 + 1)
  16. stars = stars - 2;
  17. else
  18. stars = stars + 2;
  19. System.out.println();
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement