Răspuns :
#include <iostream>
using namespace std;
int main(){ int v[20],n,i,invers; cout<<"n=";cin>>n; for(i=1;i<=n;i++) cin>>v[i]; cout<<"Elementele palindrom sunt: "; for(i=1;i<=n;i++){ int ma=v[i]; invers=0; while(ma) { invers=invers*10+ma%10; ma=ma/10; } if(v[i]==invers) cout<<v[i]<<" ";} }
using namespace std;
int main(){ int v[20],n,i,invers; cout<<"n=";cin>>n; for(i=1;i<=n;i++) cin>>v[i]; cout<<"Elementele palindrom sunt: "; for(i=1;i<=n;i++){ int ma=v[i]; invers=0; while(ma) { invers=invers*10+ma%10; ma=ma/10; } if(v[i]==invers) cout<<v[i]<<" ";} }
#include <fstream>
using namespace std;
ofstream fout("model.out");
ifstream fin("model.in");
int main()
{
int nr;
while(fin >> nr)
if(nr >= 100 && nr < 1000 && nr % 10 == nr / 100)
fout << nr << '\n';
return 0;
}
using namespace std;
ofstream fout("model.out");
ifstream fin("model.in");
int main()
{
int nr;
while(fin >> nr)
if(nr >= 100 && nr < 1000 && nr % 10 == nr / 100)
fout << nr << '\n';
return 0;
}