Tuesday, August 19, 2014

COJ 1288. Div 6

If the number is divisible both on 3 and on 2 than the number is divisible on 6. The rule of divisibility to 3 is: if the sum of digits of the number is divisible on 3 then the number itself is divisible on 3. The rule of divisibility of 2 is the following: if the last digit of the number is divisible on 2 than the number is divisible by 2. The input is a large number so we need to input it as a string and then check the sum of it's digits and the last digit.


      FULL SOURCE CODE

No comments:

Post a Comment