Codul e in C++, si poate e putin mai complicat decat ar fi trebuit. Daca ai neclaritati/intrebari, lasa-le aici si o sa incerc sa revin=)
Spor
#include <iostream>
#include <vector>
bool parImp(unsigned nr){
return (nr%2==0); // daca restul impartirii numarului la 2 = 0, nr e par, altfel nr e impar
}
int main()
{
unsigned a;
std::vector <unsigned> a_vect;
while(a!=350){
std::cin >> a;
a_vect.push_back(a);
}
for(int i=0;i<a_vect.size();i++){
if(a_vect[i+1]==350) break;
if(parImp(a_vect[i])==parImp(a_vect[i+1])) std::cout << a_vect[i] << "-" << a_vect[i+1] << " ";
}
return 0;
}