Lecture 3 Objectives
At the end of today's class you should
KNOW:
- C's three looping constructs: while, do...while,
and for
- The difference between count-controlled loops and sentinel-controlled
loops
- That cast operators can be used to convert one data type to another
BE ABLE TO:
- Use any of C's looping constructs to accomplish iteration
- Explain how a cast operator affects the value of an expression
Sample Exam Question:
Use a for-loop to calculate the sum of all the even numbers between
2 and 100, inclusive (the values 2 and 100 should be included in the sum).