Discussion Assignment - CS 303e


1. Write a function printTriangle(n) that, without using the repetition operator, prints the following output. The argument n is a positive integer, and is equal to the number of asterisks in the top row of the triangle. The second row has n-1 asterisks, ..., and the last row contains 1 asterisk. If n is not positive, do not display any output.

***********************
  **********************
    *********************
     ********************
       *******************
                          ...


                                 ***
                                  **
                                   *


2. Write a function smallestDivisor(n) which takes a positive integer n, and returns the smallest divisor greater than or equal to 2 of n. If n is not positive, return 0.