3 ms·
I think it just means taking the input as an integer and then separating out the “ones place”and “tens place” using integer division and modulo operator. E.g.,
by monkeyjoe 3y ago
I think it just means taking the input as an integer and then separating out the “ones place”and “tens place” using integer division and modulo operator. E.g.,
ones = number % 10
tens = number // 10
do_print = (ones + tens) == 10
- harshalizee 3y agoThat's what my solution after the parsing would be. OP mentioned reading from a file, which you would only be able to use after string conversion to ints.
- ProZsolt 3y agoMaybe they didin't calculated the digits, like this: if toInt(number) % 10 != 0 print number else print number + "(" + number[0] + "," + number[1] + ")"
- hahamrfunnyguy 3y agoYes. This is the mathematical solution.