Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a;
- string even="";
- string odd="";
- for(int i=0;i<10;i++){
- cin>>a;
- a%2==0?even.append(to_string(a)+" "):odd.append(to_string(a)+" ");
- }
- if(even.empty())
- even="There is no even numbers.";
- if(odd.empty())
- odd="There is no odd numbers.";
- cout<<even<<"\n"<<odd;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment