The decimal count in my code is increasing

Please check the code

In java there is a concept of called “Widening or Automatic Type Conversion” for datatypes(You can google it).
So when you do, inc = inc/10, here that is happening due to which it is converting into double.

So its better to use double for calculation and return float. Here is the changed code https://ide.codingblocks.com/s/223397