Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class hourglass {
- public static void main(String[] args) {
- int spaces = 0;
- int start = 15;
- int stars = start;
- for (int one = start; one > 0; one--) {
- if (one > start/2)
- spaces = start - one;
- else
- spaces--;
- for (int two = spaces; two > 0; two--)
- System.out.print(" ");
- for (int three = stars; three > 0; three--)
- System.out.print("*");
- if (one > start/2 + 1)
- stars = stars - 2;
- else
- stars = stars + 2;
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement