Both 5 an 9 are ints, so 5/9 is 0. Since 0 % 2 is 0, and 0 will not be equal to 1 forever, you have an infinite loop.I think I'm going to add a sentence to chapter 6 that says n should be an int >= 1.
btw. I've changed this section of chapter 6 in response to your posting here so that it now states that n is a positive integer.
Both 5 an 9 are ints, so 5/9 is 0. Since 0 % 2 is 0, and 0 will not be equal to 1 forever, you have an infinite loop.
ReplyDeleteI think I'm going to add a sentence to chapter 6 that says n should be an int >= 1.
btw. I've changed this section of chapter 6 in response to your posting here so that it now states that n is a positive integer.
ReplyDelete