Answer to Question #264250 in C++ for fiona

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.


1
Expert's answer
2021-11-11T00:06:19-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS