BU CAS CS 111: Introduction to Computer Science I

Spring 1998

Assignment 2
(due Friday 98.02.06 at 5 p.m. in room MCS 138)


  1. [4 points] Exercise 3.13, page 91.
    The program given in the book computes the sum of squares from 1 to 10 (inclusive), i.e. the final value of the variable "total" is 1*1 + 2*2 + 3*3 + ... + 10*10. We want you to modify the program so that it now computes the sum of squares of even numbers between 1 and z (inclusive), where "z" is a variable which is assigned an input value from the keyboard. Run your program for the following values of z: 5, 7, and 8.

  2. [4 points] Exercise 3.33, page 97.
    Your program must use looping (a "while" statement).

  3. [4 points] Exercise 3.35, page 98.

Assaf Kfoury
Created: 98.01.29