I want to split my int value into digits. eg if the no. is 542, the result should be 5,4,2.
I have 2 options. 1) Convert int into String & then by using getCharA
int digits(int i) { int num=0; while(i > 0) { num *= 10; num += i % 10; i /= 10; } return num; }