5-2

mail@pastecode.io avatar
unknown
plain_text
2 years ago
328 B
1
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

int main() {
	system("chcp 1251");
	cout << "Введите число: ";
	int num;
	cin >> num;
	int digit;
	string s;
	while (num != 0) {
		digit = num % 10;
		s += to_string(digit);
		num = num / 10;
	}
	reverse(s.begin(), s.end());
	cout << s;
}