EX. I want to accept numbers which have maximum of 2 digits after decimal points. i, e, 10.23 should be allowed and 10.233 should not be allowed. What mathematical operations can be done to distinguish these two numbers. These numbers are coming as an input from the console. Please help, Thanks
2026-03-27 01:54:20.1774576460
How to identify whether a fractional part of a number contains more that 2 digits.
224 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
For a number $x$ look at the fractional part of $100x$. If it is non-zero, then you have more than 2 decimal points
Example:
$\{100(10.23)\}= \{1023.0\} = 0$
$\{100(10.233)\}= \{1023.3\} = 0.3$