Given a number {data}, check if it is divisible by 7 or not without using modulo operator and floating point arithmetic.
"A number of the form 10a + b is divisible by 7 if and only if a – 2b is divisible by 7." If you don't know this rule, keep subtracting 7 from your number until you reach a number less than 7. If the final number is 0, then the original number is divisible by 7.
n = 36 n = abs(n) while(n >= 7): n -= 7 print(n == 0)
let n = 36; n = Math.abs(n); while(n >= 7) { n -= 7; } console.log(n == 0);