PHP: While Loops III

Derek Bridge

Department of Computer Science,
University College Cork

PHP: While Loops III

Aims:

for-loops versus while-loops

Class exercise: Are these equivalent?

Class exercise

Compound interest

You deposit 1000 eurines in your Allied Nerdish Bank account. At the end of each year, 10 per cent cumulative interest is added

YearDepositInterest earned
11000100
21100110
31210121
41331133.1
51464.1

Class exercise I

Class exercise II

Pointers for advanced students

Flowchart

[A flowchart showing a do...while-loop.]