Friday, August 19, 2011

Anyone know how to program a computer in C++ to execute Lewis Carroll's 11 divisibility rule?

Charles L. Dodgson (Lewis Carroll) wrote an algorithm for determining whether a large number was divisible by 11. You have to subtract the ones digit from the rest of the number until the number is less than 100. If the resulting number is divisible by 11 then so is the number. I have to write a program in C++ that does this, but I don't know how to program the computer to separate the last digit. Anyone know how?

No comments:

Post a Comment