Exercises

  1. Write a function print_triangular_numbers(n) that prints out the first n triangular numbers. A call to print_triangular_numbers(5) would produce the following output:

    1       1
    2       3
    3       6
    4       10
    5       15
    

    (hint: use a web search to find out what a triangular number is.)


    
    
    

    (ex_7_8)

Next Section - What Is Recursion?