SHARE
TWEET

Untitled

a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int number, even = 0, odd = 0, sent = 0;
  6.     do {
  7.         cout << "Enter a number: ";
  8.         cin >> number;
  9.        
  10.         if(number % 2 == 0) {
  11.             even = even + number;
  12.         } else {
  13.             odd = odd + number;
  14.         }
  15.     } while(number != sent);
  16.    
  17.     cout << "Sum of even numbers: " << even << endl;
  18.     cout << "Sum of odd numbers: " << odd << endl;
  19.     return 0;
  20. }
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Top