15. 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.
Ex, No. 1: 5 No. 1: 3
No. 2: 3 No. 2: 2
Sum is : 8 One of the number entered is not ODD
#include<iostream>
using namespace std;
int main(){
cout<<"Enter the first number:\n";
int first;
cin>>first;
cout<<"Enter the second number:\n";
int second;
cin>>second;
if(first%2 != 0 && second %2 != 0){
cout<<"The addition of the two numbers are : "<<first + second<<endl;
}
else{
cout<<"All are not odd\n";
}
}
Comments
Leave a comment