Integer to decimal notation

I have a task
“Write a function that takes a positive integer. Function must return true if the decimal representation of that integer contains no odd digits, and return false otherwise.”

Not entirely sure how to interpret this task. Isn’t “decimal representation” used to describe standard integers sometimes (e.g 125 is 125 in decimal notation)? Or is it likely referring to the powers of 10 in the “decimal breakdown”, and input such as 24 would return false because 24 = 2 * 10^1(odd digit) + 4 * 10^0, because the one is an odd digit?

I think they mean decimal as opposed to binary. So yeah, I would say 125 is 125. So you would need to check each digit in turn, and return false if even one of them is odd.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.