Note: don't worry if you can't finish the entire lab exercise. Use turnin (see step 8) to turn in as much as you've completed before you leave the lab. If you don't finish in 50 minutes, you should try to complete the lab on your own time.
1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + ... + 1/20(Hints: This is a summing loop, so you need to set your summing variable to 0. This is also a count-controlled loop; set up the loop so that it will execute 20 times.
PRE: none
POST: the function returns the sum of the series
1 + 1/2 + 1/3 + ... + 1/20
Design a black box for sumFractions (you don't have to submit your
black box drawing). Use the black box to help
you determine the prototype for the function. Insert the prototype and
the function definition in your program. Change the main function so
that it calls sumFractions.
PRE: low and high are positive int's, low <= high
POST: the function returns the sum of the series
1/low + 1/(low+1) + 1/(low+2) + ... + 1/high
Design a black box for sumRange. Use the black box to help
you determine the prototype for the function. Insert the prototype and
the function definition in your program. Change the main function so
that it calls sumRange (you will also need to add to the main
function statements that prompt the user and accept input values for
the function arguments).
See you next week!