Răspuns :
O sa iti scriu doar declaratiile si main-ul
1. int n,ok=1,c;
int main(){
cin>>n;c=n%10;n/=10;
while(n)
{if(n%10%2!=c%2) {ok=0;break;}
c=n%10; n/=10;
}
if(ok) cout<<"Aceeasi paritate";
else cout<<"NU";
}
2. int n,p,c,nr,i=1;
int main(){cin>>n>>c;
while(n){if(n%10==c) nr++; p=p*10+n%10;
n/=10;} cout<<"Cifra apare de "<<nr<<"ori"<<endl;
while(p){if(p%10==c) cout<<i<<' ';
i++; p/=10;
}
}
3. Cerinta e putin cam neclara
4. int n, p,a,b;
int main(){cin>>n;
//pentru a crea un nou numar cu cifrele in ordinea in care apar(stanga-dreapta) realizam oglinditul numarului initial.Cu aceasta ocazie cream si b, al doilea numar
while(n){if(n%10%2) b=b*10+n%10;
p=p*10+n%10; n/=10;
}
while(p){if(p%10%2) a=a*10+p%10;p/=10;
}
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
}
1. int n,ok=1,c;
int main(){
cin>>n;c=n%10;n/=10;
while(n)
{if(n%10%2!=c%2) {ok=0;break;}
c=n%10; n/=10;
}
if(ok) cout<<"Aceeasi paritate";
else cout<<"NU";
}
2. int n,p,c,nr,i=1;
int main(){cin>>n>>c;
while(n){if(n%10==c) nr++; p=p*10+n%10;
n/=10;} cout<<"Cifra apare de "<<nr<<"ori"<<endl;
while(p){if(p%10==c) cout<<i<<' ';
i++; p/=10;
}
}
3. Cerinta e putin cam neclara
4. int n, p,a,b;
int main(){cin>>n;
//pentru a crea un nou numar cu cifrele in ordinea in care apar(stanga-dreapta) realizam oglinditul numarului initial.Cu aceasta ocazie cream si b, al doilea numar
while(n){if(n%10%2) b=b*10+n%10;
p=p*10+n%10; n/=10;
}
while(p){if(p%10%2) a=a*10+p%10;p/=10;
}
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
}