Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- int n,x,y,z=0,i=0,j=0,v[50],schimb=0,a,b;
- f1>>n;
- while(f1>>x){
- y=x;
- while(y!=0){
- z=z*10+y%10;
- y=y/10;
- }
- if(x==z){
- b=0;
- f2<<x<<" ";
- while(z!=0){
- b++;
- z=z/10;
- }
- if(b%2!=0){
- i++;
- v[i]=x;
- }
- }
- z=0;
- }
- f2<<endl;
- for(a=1;a<i-2;a++){
- for(j=a+1;j<i-1;j++)
- if(v[a]>v[j]){
- schimb=v[a];
- v[a]=v[j];
- v[j]=schimb;
- }
- }
- for(a=1;a<=i;a++)
- f2<<v[a]<<" ";
- f2.close();
- f1.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement