Question #268532

Make a program that will input two number, If the two number entered are ODD 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>
using namespace std;
int main(){
	cout<<"Enter the first number: ";
	int firstNumber;
	cin>>firstNumber;
	cout<<"Enter the second number: ";
	int secondNumber;
	cin>>secondNumber;
	if(firstNumber%2 == 0 || secondNumber %2 == 0){
		cout<<"Numbers are not odd.\n";
	}
	else{
		cout<<"\nSum = "<<(firstNumber + secondNumber)<<endl;
	}
	cin>>firstNumber;
	return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS