Răspuns :
1.
#include <iostream>
using namespace std;
int main()
{unsigned int n,x=0,p=1,ult;
cin>>n;
while (n>0)
{ult=n%10;
ult=ult-1;
x=x+p*ult;
p=p*10;
n=n/10;}
cout<<x;
return 0;
}
2.
#include <iostream>
using namespace std;
int main ()
{unsigned int a,b;
cin>>a>>b;
cout<<a*100+a*10+b<<' '<<a*100+b*10+a<<' '<<b*100+a*10+a<<endl;
return 0;
}
Explicație:
#include <iostream>
using namespace std;
int main()
{int n,p,x,y,z,a,b;
cout<<"Care program doriti ? 1 pentru micsorarea fiecarei cifre cu 1 si 2 pentru a vedea permutarile";
cout<<endl;
cin>>p;
if(p==1){
cin>>n;
x=n%10-1;
y=n%100/10-1;
z=n/100-1;
cout<<100*z+10*y+x;
}
if(p==2){
cin>>a>>b;
cout<<100*a+10*a+b<<''<<100*a+10*b+a<<''<<100*b+ 10*a+a;
}
return 0;
}
coroana te rog