how would i do this?
Create a program that will do the following
• Ask the user to enter an unknown set of integers, and stop when they enter 9999
• Add up all the even numbers.
• After the loop, print the sum of the even numbers with a label

Respuesta :

Answer:

#include <iostream>

using namespace std;

int main() {

   int num = 0, sum = 0;

   do {

       cin >> num;

       if (num % 2 == 0) {

           sum += num;

       }

   } while (num != 9999);

   cout << "The sum of the even numbers is " << sum;

}