Answer to Question #264889 in C++ for Rille

Question #264889

14. 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.


Ex, No. 1: 4 No. 1: 3


No. 2: 2 No. 2: 2


Sum is : 6 One of the number entered is not Even



1
Expert's answer
2021-11-12T17:34:47-0500
#include<iostream>
using namespace std;
int main()
{
	int n,x;
	cout<<"No. 1:";
	cin>>n;
	cout<<"No. 1:";
	cin>>x;
	if(n%2==0&&x%2==0){
		int sum=x+n;
		cout<<"Sum is: "<<sum;}
	else{
		cout<<"No. 2: ";
	cin>>n;
	cout<<"No.2:";
	cin>>x;
	if(n%2==0&&x%2==0){
		int sum=x+n;
		cout<<"Sum is: "<<sum;
	}
	else{
		cout<<"No.3: ";
	cin>>n;
	cout<<"No.3:";
	cin>>x;
	if(n%2==0&&x%2==0){
		int sum=x+n;
		cout<<"Sum is: "<<sum;
	}
	}
	}
}

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