How to access each digit in an int in Java
1 2 3 4 5 6 7 |
int n ; // some integer while ( n > 0){ int digit = n % 10 ; //ones place digit print(digit) ; n = n / 10 ; // now the ones place by int division } |
How to access each digit in an int in Java
1 2 3 4 5 6 7 |
int n ; // some integer while ( n > 0){ int digit = n % 10 ; //ones place digit print(digit) ; n = n / 10 ; // now the ones place by int division } |