Lecture 10: If Statements & While Loops
Tuesday, October 04, 2011 Status: complete[Up] [Previous Lecture] [Next Lecture]
Powerpoint Slides: none
Reading Assigned: 4.1-4.4, 5.1-5.3
Homework Due: Homework 4
Homework Assigned: Homework 5
Topics Covered:
- if statements
- while loops
- Classwork 10
Programs Shown:
- Programs showing if statements:
- Don't divide by zero: if1.c
- Used = instead of ==:
if2.c
Dont' copy this program. It is deliberately buggy! - Using the else part: if3.c
- Floating point round off errors:
if4.c
Dont' copy this program. It is deliberately buggy! - More comparisons: if5.c
- Using and's and or's: if6.c
- More and's and or's: if7.c
- Programs showing while loops:
- Printing out multiples of 17 the tedious way: seventeen1.c, seventeen2.c and seventeen3.c.
- Using a while loop to print out multiples of 17: while1.c. `
- Let the user pick the number of multiples of 17: while2.c.
- Let the user pick where the table starts too: while3.c