Last night I was bored, and decided to tackle a Programming Challenges problem: 110507 The Stern-Brocot Number System seemed easy, and in the end it was.
However it took two attempts, due to messing up the termination logic. ie run till m and n are both 1
I first had:
while (m != 1 && n != 1)
instead of:
while (m != 1 || n != 1)
maybe I should have used
while (!(m == 1 && n == 1))
Gosh I dislike double negatives to loop logic.