Announcements
|
|
Unit3 deals with the control structures
that allow us to program repetition of several statements in a way
controllable by the inputs to the program. These structures are also called loops ( while loops, do while loops, for loops etc. ). This material is very basic and
important. You will need it and use it continually from this point
onward. You must make every effort to learn it well.
|
|
|
Reading
Assignments
|
|
Mandatory: Book 1; Pages 109- 131 & 138 - 149
|
|
|
|
Subtopics — Notes/
Examples:
|
Loops
classified by structure type:
- while ( condition ) ….{ statements }
- do ..
{ statements } …..while ( condition )
- for ( initialization ; condition ; update ) … {
statements }
Loops
classified by utility:
|
|
Tasks:
|
- Write
a program which calculates the average of several test scores entered
through the keyboard. The sentinel value -1 should terminate the loop.
Your program should count the number of the scores entered.
- Write
a program which calculates the product of 1*2*3*……..*34. This product is called "factorial of 34" and it is written
as 34!
- Start working on
HW3 and PA3.
|
|
|
|
|
|
Jacob Y. Kazakia
© 2001 All rights reserved
|