Untitled

mail@pastecode.io avatar
unknown
c_cpp
12 days ago
352 B
0
Indexable
Never
#include <iostream>
#include <math.h>
using namespace std;

void reverse(int a) {
	int n = a, b = 0, m = a;
	while (n != 0) {
		n %= 10;
		m /= 10;
		n = m;
		b++;
	}
	n = a;
	for (int i = 0; i < b; i++) {
		cout << n % 10;
		a /= 10;
		n = a;
	}
}

int main() {
	setlocale(LC_ALL, "Russian");
	int a;
	cin >> a;
	reverse(a);
}
Leave a Comment