You are on page 1of 1

#include <iostream>

using namespace::std;

int main( ) {
int n1, n2, choice;
cout<<"Make a choice."<<endl;
cout<<" 1-Test whether a given number is odd or even."<<endl;
cout<<" 2-Test whether a given number is divisible by another number."<<endl;
cout<<"Choice: ";
cin>> choice;
if (choice==1){

cout<<"Enter a number: ";


cin>>n1;
if (n1%2==0){
cout<<n1<<" is an even number" <<endl;
}else
cout<<n1<<" is an odd number"<<endl;
}
if (choice==2){
cout<<"Enter first number: ";
cin>>n1;
cout<<endl<<"Enter second number: ";
cin>>n2;
if(n1%n2==0){
cout<< n2 <<" divides "<<n1;
}else if(n1%n2!=0){
cout<< n2 << " doesn't divide "<<n1;
}
} else
cout<<"Input error! Try Again."<<endl;

return 0;
}

You might also like