1. Write a program that draws a triangular tree, and the user provides the tree's height. A typical run of the program looks like the following:

    $ ./tree
    Enter height of tree: 10
              *
             ***
            *****
           *******
          *********
         ***********
        *************
       ***************
      *****************
     *******************
    
    The source code is given here.
  2. Read in a number n and print out the value of $$\sum_{k=0}^n {n \choose k},$$ that is, the sum as k goes from 0 to n of n choose k.

    The formula for n choose k is $$\frac{n\cdot(n-1)\cdot(n-2)\cdots(n-k+1)}{k\cdot(k-1)\cdot(k-2)\cdots 1}$$

    So, for example 7 choose 3 is (7*6*5)/(3*2*1) = 35.

    Notice that this number will always be an integer! So do all of your computations using type int, and don’t do anvy division unless you're sure you'll get exact results, i.e. no remainder.

    Sample run:

    $ ./binom
    Please enter n: 4
    Sum as k goes from 0 to 4 is 16
    $ ./binom
    Please enter n: 9
    Sum as k goes from 0 to 9 is 512
    
    Take a look at this solution to the problem.
  3. Write a program that works as follows:
    1. The user provides a positive integer.
    2. The program draws a letter X using @'s and .'s.
    3. The number from the user input determines the size of the letter X. For example, if the input was 5, the letter should be drawn over 5 rows and 5 columns.
    Here are sample runs:
    ~/$ ./p3
    Enter a number: 5
    @...@
    .@.@.
    ..@..
    .@.@.
    @...@
    
    ~/$ ./p3
    Enter a number: 10
    @........@
    .@......@.
    ..@....@..
    ...@..@...
    ....@@....
    ....@@....
    ...@..@...
    ..@....@..
    .@......@.
    @........@
    
    ~/$ ./p3
    Enter a number: 15
    @.............@
    .@...........@.
    ..@.........@..
    ...@.......@...
    ....@.....@....
    .....@...@.....
    ......@.@......
    .......@.......
    ......@.@......
    .....@...@.....
    ....@.....@....
    ...@.......@...
    ..@.........@..
    .@...........@.
    @.............@
    
    Solution: here.