How it works
Try a program with several examples, not just one. One good try is only one try.
Write down the answer you want first, so a mismatch is easy to spot.
Pick small numbers, big numbers and zero.
Compare what you want with what you get. When they do not match, that is how you spot a bug.