In class today, pick one (or several) of the following assignments to practice programming concepts in preparation for the final:

Exercise 1
Looping: Write a program that asks the user for a start number, and end number, and a counting interval. The program will then count up from the start to the end, incrementing by the counting interval. For example:
Give me a start: 4
Give me a finish: 24
Give me an increment: 2.5
4 6.5 9 11.5 14 16.5 19 21.5 14

My answer
Array: Build on your program by storing the numbers to be output in an array and using a second loop to output each element of the array. You will want the maximum size of the declared array to be large (e.g., 200 elements), and you will use an additional variable to keep track of how many elements of the array are actually used (as in Lab 4). My answer
Function: Build on your program by writing a function to compute the number in the interval between the start and end number. Take in an array (and array size) as input that you will change as the function runs. My answer

Exercise 2
Function: For each example below you should declare, define, and call the function specified.

Exercise 3
Arrays: Declare a 7-element array of integers and initialize all its elements in the code -- e.g., you can set the values to 20, 17, 45, 32, 11, 48, and 26.
Output the members of the array in order (preferably using a for loop).
Use a loop to count the number of elements less than 20. Output that number. -- for the example above, we would output 2
Use a loop to count the number of elements that are multiples of 4. Output that number. -- for the example above, we would output 3.
My answer


The following constitute greater challenges to work on! — Exercises 4 and 5 are more challenging, but worth completing as further finals practice.
Exercise 4
Recursion: The Fibonacci sequence begins with the numbers 1, 1, 2, 3, 5, 8, 13, ... and continues to infinity. Each new number is computed by adding the previous two numbers in the sequence. So, the 7th Fibonacci number is 13 because the 5th and 6th numbers are 5 and 8, respectively, and 5+8=13. The first two numbers in the sequence are defined to both be 1 (as shown above). Write a recursive function to compute the nth Fibonacci number. -- You can look at the recursive factorial function to review recursion.
My answer

Exercise 5
More loops and arrays: Given an array of integers (they can be input by the user or defined in the program before compiling), find the greatest common denominator of all the integers in the array --- that is, the largest integer that evenly divides all the integers in the array (without leaving any remainder). The greatest common denominator of 14, 49, and 63 would be the number 7. The greatest common denominator of 4, 18, and 36 would be the number 2.
My answer

Exercise 6
Debugging and sorting: Complete and debug the sort function I placed online for the November 17 class. -- Recall, if an array starts out with the contents 5, -12, 8, 4, and 6, the sorted array will be in the order -12, 4, 5, 6, and 8.

Exercise 7
Classes: Complete the final listed task for the cow class assignment from our last lab session.