Skip to content

Instantly share code, notes, and snippets.

@geekf
Last active August 29, 2015 14:23
Show Gist options
  • Save geekf/59fa93758d23287ff72d to your computer and use it in GitHub Desktop.
Save geekf/59fa93758d23287ff72d to your computer and use it in GitHub Desktop.
Deduce the numbers - Whatsapp Puzzle
/*
solve this....
(b)(r)(w)
+(b)(r)(w)
+(b)(r)(w)
----------
(w)(w)(w)
What numbers are (b),(r),(w)?
*/
(function() {
for (var i=1; i<10; i++) {
var sum = 111*i;
var num = sum/3;
if ((num)%10 == sum%10) {
var numStr = num.toString();
console.log("(b):"+numStr[0]+", (r):"+numStr[1]+", (w):"+numStr[2]);
break;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment