rijads

Untitled

Dec 18th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int a;
  6.     string even="";
  7.     string odd="";
  8.     for(int i=0;i<10;i++){
  9.         cin>>a;
  10.         a%2==0?even.append(to_string(a)+" "):odd.append(to_string(a)+" ");
  11.     }
  12.     if(even.empty())
  13.         even="There is no even numbers.";
  14.     if(odd.empty())
  15.         odd="There is no odd numbers.";
  16.     cout<<even<<"\n"<<odd;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment