/* Construct a fun class. It contains a main method.
The class takes in user inp
ut a number. * The number is the number of rows in your tree including the christmas tree. * For example, if a use inputs 5, the output would be: * * * *-* * *---* * *-----* * *-------* * If the user inputs 2, the output would be: * * * *-* * If the user inputs 10, the output would be: * 1 * 0 * 2 *-* 1 * 3 *---* 3 * 4 *-----* 5 * 5 *-------* 7 * 6 *---------* 9 * 7 *-----------* 11 * 8 *-------------* 13 * 9 *---------------* 15 * ...and so forth. * */ import java.util.*; public class tree{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.print("\nOutput Number of Rows: "); int s = Integer.parseInt(sc.next()); draw(s); } public static void draw(int n){ for(int k = 0; k < n; k++){ for(int j = 1; j <= (n - 1 - k); j++){ System.out.print(" "); } System.out.print("^"); for(int i = 1; i <= ((2*k) - 1); i++){ System.out.print("-"); } if(k != 0){ System.out.print("*"); } System.out.println(); } } }