1.
#include <iostream>
using namespace std;
int main()
{
int x, y;
cin>>x;
while (x>0)
{
cin>>y;
if (x>y)
{
cout<<x%10<<" ";
}
else
{
cout<<y%10<<" ";
}
x=y;
}
}
raspunsul este 2 2 1 1 7 7 5
2.
#include <iostream>
using namespace std;
int main()
{
int n, z=0, p=1, c;
cin>>n;
while (n>0)
{
c=n%10;
n=n/10;
if (c%3==0)
{
z=z+p*(9-c);
p=p*10;
}
}
cout<<z;
}
raspunsul este 963