ICS 101 - Computer programming

Lab # 8

(DO LOOP)

 

Objectives

 

 

Syntax

 

 

 

 

 

 

 

 

 

 

Exercise 1

 

Write a  program which calculates and prints the sum of the first 300 terms of the infinite series:

 

      2       5       8       11               

     ---  +  ---  +  ---  +  ---- +  . . .  

      2       6       10      14 

 

Your output should be:

            SUM  =  225.958400

 

Exercise 2

 

Write a program that finds an approximation for PI using the first 10000 terms of the following infinite series:

 

            6          6         6                      

p2  =   ----  +   ----  +   ----    +  . . .  

           12        22        32       

 

your output should be:

 

PI  =   3.141363