Answers for "how to print all numbers in an integer in c++"

C++
0

how to print all numbers in an integer in c++

#include<iostream>
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;
	print_each_digit(i);
	return 0;
}
Posted by: Guest on August-11-2020

Code answers related to "how to print all numbers in an integer in c++"

Browse Popular Code Answers by Language