CS 200 - Lab 5

Series Sum

Consider the following mathematical series:

1/2 + 1/4 + 1/8 + 1/16 + 1/32 + ...

If we continue this series to an arbitrary number of terms, the sum will approach 1.

Getting Started

If you have a solution open in Visual Studio, close it (File->Close Solution).

Download lab5.zip.  Import it into Visual Studio (File->Import...).

Add your code to the source file called Series.c.

Your Task

Write a program to compute the sum of the first 7 terms in this series and print the result.

The output of your program should look something like the following:

sum is 0.992249

Hints

The first 7 powers of two are 2, 4, 8, 16, 32, 64, and 128.