Check out example codes for "how to print all numbers in an integer in c++". It will help you in understanding the concepts better.

Code Example 1

using namespace std;
void print_each_digit(unsigned long long int x)
    if(x >= 10)
       print_each_digit(x / 10);

    int digit = x % 10;

    cout << digit << '\n';
int main(){
	unsigned long long int i;
	cin >> i;
	return 0;

Learn ReactJs, React Native from