Răspuns:
#include <iostream>
using namespace std;
int main ()
{
int a, inv;
cin >> a;
inv = 0;
while (a != 0) {
inv = inv * 10 + a % 10;
a = a / 10;
}
cout << inv << endl;
return 0;
}
si
#include <iostream>
using namespace std;
int main ()
{
int a, b, r;
cin >> a >> b;
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
cout << "cmmdc este: " << b << endl;
return 0;
}
Explicație: