Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class xmas {
- public static void main(String[] args) {
- int initrow = 3;
- int treeunit = 3;
- int colin = 2;
- int maxcol = initrow + (treeunit - 1) * colin;
- for (int i = 0; i < treeunit; i++) {
- for (int k = 1; k <= initrow + 2 * (i); k++) {
- for (int x = 0; x < maxcol - k; x++) {
- System.out.print(" ");
- }
- for (int z = 0; z < k; z++) {
- System.out.print("* ");
- }
- System.out.println("");
- }
- }
- System.out.println("merry christmas");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment