#include <iostream>
#include <cmath>
int main() {
int n = 78910;
int size = std::log10(n) + 1; // for n > 0
int *arr = new int[size];
for (int i = size - 1; i >= 0; i--) {
arr[i] = n % 10;
n = n / 10;
}
for (int i = 0; i < size; i++) {
std::cout << "arr[" << i << "] = " << arr[i] << "\n";
}
delete [] arr;
}
/*
run:
arr[0] = 7
arr[1] = 8
arr[2] = 9
arr[3] = 1
arr[4] = 0
*/