Question #264250

Using while or do-while loop. Make a program that will input two number, If the two number entered are EVEN then perform the addition and display the Sum. Your program will be terminated by an option if the user not to proceed another entry.


Expert's answer

#include <iostream>


int main()
{
    int firstNumber;
    int secondNumber;
    char choise{ 'Y' };
    do 
    {
        std::cout << "Enter first integer number : ";
        std::cin >> firstNumber;
        std::cout << "Enter second integer number : ";
        std::cin >> secondNumber;
        if (firstNumber % 2 == 0 && secondNumber % 2 == 0)
            std::cout << "Sum of even numbers: " << firstNumber + secondNumber << "\n";
        std::cout << "Continue (Y/n) ";
       std::cin >> choise;
    } while (choise != 'n');
   
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS