5-2

 avatar
unknown
plain_text
3 years ago
328 B
2
Indexable
#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;
}
Editor is loading...