The only problem here is checking of the divisibility part. How do we check if the number if divisible by 7 or not? Here is how, we take the numbers 1 3 2 6 4 5 and loop over the number from the other end and add the current digit multiplied by the current number in the given sequence. If we divide the number to 7 and take the remainder it will give the same answer as the remainder of the initial number divided by 7 and taken the remainder.
No comments:
Post a Comment