Extracting whole number digits from a float

I need to extract the whole number digits from a number that has decimal point. for example I need only the first 3 digits of a number like 143.454369 which will be 143. I can get it by dividing it with its place value but the problem is that the number will be supplied by the user in my program.

so I don't know how long the number will be and how to divide it by place value.

please help.

Re: Extracting whole number digits from a float

Have you tried casting the number to an int?

Re: Extracting whole number digits from a float

Quote:

Originally Posted by

**helloworld922**
Have you tried casting the number to an int?

Nope, forgot it but after you've reminded me of casting integer, I did it and the code worked. Thank you so much.