Skip navigation.

CS 135 Programming Logic

Urn World Tutorial

Chapter 4: Counters and Arithmetic

Balls are numbered. We ought to be able to take balls out of urns and do something with the numbers; for example, add up the numbers, look for a ball with a particular number, sort the balls according to their numbers and so on. This chapter introduces numeric operations.

  1. Arithmetic
  2. Counters
  3. Count the Balls
  4. Count the Balls (again)
  5. Sum the Balls
  6. Search for a Particular Number
  7. Problems

Check the appendix if you want to see a quick list of available arithmetic operations and examples of usage.