fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int num=0, sum=0;
  8.  
  9. cin>>num;
  10. while (num%2 != 0){
  11. cout<<num;
  12. sum += num;
  13. cin>>num;
  14. }
  15. cout<<endl;
  16.  
  17. cout<<"Sum is "<<sum<<endl;
  18.  
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3144KB
stdin
11   21    5     7   16    8
stdout
112157
Sum is 44