java separate digits of int code example
Example: how to separate a number into digits java
public static void main(String[] args) {
int num=1020; // int number
while (num > 0) {
System.out.println( num % 10);
num = num / 10;
}
}
public static void main(String[] args) {
int num=1020; // int number
while (num > 0) {
System.out.println( num % 10);
num = num / 10;
}
}