+ 1

Is there any other way for me to remove the Nine? even a shorter way to do it?

https://code.sololearn.com/c1qXWzcFjD6A/?ref=app

13th Apr 2018, 4:23 AM
Jan Paul Echaveria
Jan Paul Echaveria - avatar
4 Antworten
+ 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
13th Apr 2018, 4:35 AM
cyk
cyk - avatar
+ 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
13th Apr 2018, 4:37 AM
cyk
cyk - avatar
+ 1
nice method. never thought about that
13th Apr 2018, 6:29 AM
Jan Paul Echaveria
Jan Paul Echaveria - avatar
0
You can do this int remove9= num%100; That's it
13th Apr 2018, 8:41 AM
Twenty-three