Răspuns:
#include <iostream>
using namespace std;
int rast(int n){
int rs = 0;
while (n) {
rs = rs * 10 + n % 10;
n /= 10;
}
return rs;
}
int main(){
int n;
int s = 0;
cout << "n=";
cin >> n;
while (n) {
int c = n % 10;
if (c % 3 != 0){
s = s * 10 + c;
n /= 10;
}
else
n /= 10;
}
int rs = rast(s);
cout << rs;
return 0;
}
Explicație: