Mssw.ch3

Chapter 3
The question probably left out `num`, `sum` and `count` for brevity - assume this is a fragment of code found in a larger block.