aboutsummaryrefslogtreecommitdiffstats
path: root/C++/rec.cpp
blob: 9ec892e5ea9da91114860d54297e5861af1462b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

using namespace std;

void returnDigits(int&);

int main(int argc, char** argv) {
	int n;
	cout << "input a number to seperate:" << endl;
	cin >> n;
	returnDigits(n);
	return 0;
}

void returnDigits(int &n) {
	if(n > 10) {
		int d = n % 10;
		n /= 10;
		returnDigits(n);
		cout << d << endl;
	} else {
		cout << n << endl;
	}
}