Thursday, January 22, 2009

Divisibility Rules

Write a program which evaluates integers based on Divisibility Rules:
  • Is the number odd or even?
  • If the sum of the digits is divisible by 3, the number is also.
  • If the last two digits form a number divisible by 4, the number is also.
  • If the last digit is a 5 or a 0, the number is divisible by 5.
  • If the number is divisible by both 3 and 2, it is also divisible by 6.
  • If the number ends in 0, it is divisible by 10.
  • If the number is divisible by both 3 and 4, it is also divisible by 12.

.

No comments: