Check out example codes for "c++ get digits of integer". It will help you in understanding the concepts better.

Code Example 1

int iNums = 12345;
int iNumsSize = 5;
for (int i=iNumsSize-1; i>=0; i--) {
    int y = pow(10, i);
    int z = iNums/y;
    int x2 = iNums / (y * 10);
    printf("%d-",z - x2*10 );
}

Learn ReactJs, React Native from akashmittal.com