Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualiMalc

Posted 15 February 2013 - 01:43 AM

I see two bugs:

1. Lines 57 and 58 do not agree.
Either the comment is wrong, or the for-loop is wrong. If I enter 2, for example, the loop runs with values of 0, then 1, then 2, for 'count'. That's three iterations. A typical correct loop uses less-than within the comparison.

2. Lines 65 to 68 are incorrect. The value "0" is one digit!
In the past I've found that the best way to count digits, is to use a do..while loop instead.

#2iMalc

Posted 15 February 2013 - 01:31 AM

I see two bugs:

1. Lines 57 and 58 do not agree.
Either the comment is wrong, or the for-loop is wrong. If I enter 2, for example, the loop runs with values of 0, then 1, then 2, for 'count'. That's three iterations. A typical correct loop uses less-than within the comparison.

2. Lines 65 to 68 are incorrect. The value "10" contains two digits, and "100" contains three digits. You digit counts are off when the total ends in a zero. "0" is one digits as well.
In the past I've found that the best way to count digits, is to use a do..while loop instead.

#1iMalc

Posted 15 February 2013 - 01:27 AM

There is a bug: Lines 57 and 58 do not agree.

Either the comment is wrong, or the for-loop is wrong. If I enter 2, for example, the loop runs with values of 0, then 1, then 2, for 'count'. That's three iterations. A typical correct loop uses less-than within the comparison.

PARTNERS