ios - How can I get individual numbers from a 4 digit number? -


i have 4 digit number ex. 1234 how can break down it's component numbers

int = 1; int o = 2; int p = 3; int = 4; 

any thoughts appreciated.

some basic math:

int num = 1234; int = num / 1000 % 10; int o = num / 100 % 10; int p = num / 10 % 10; int = num % 10; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -