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.
#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;
}
Comments
Leave a comment