[java] reading digits from an int one at a time
I have an assignment where i have to take each digit from a zip code, and translate them into a graphical code, any suggestions on where to start
[%]mod operator returns the remainder
you can do something like this.
For example if you have a no. say 123, then 123 % 10,
Then you can get each digits of the number.
Cheers!
you can do something like this.
For example if you have a no. say 123, then 123 % 10,
steps:1. 123%10 -> you get 3now quotient 12,2. 12%10 -> you get 2now quotient 13. 1%10 -> you get 1
Then you can get each digits of the number.
Cheers!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement