+ 1
Is there any other way for me to remove the Nine? even a shorter way to do it?
4 Réponses
+ 1
Line 9. What I did is convert num to string by doing num+"" then I used the substring method of Strings to get what I wanted. Then I converted the resulting substring to int again using Integer.parseInt
https://code.sololearn.com/cvhf7P6S3od2/?ref=app
+ 1
I love this method. I use it often when the numbers might be different and I am not sure what to divide them by or if I know the exact positions of the digits I want to remove
+ 1
nice method. never thought about that
0
You can do this
int remove9= num%100;
That's it