Are you a friends ? c++ example
<h2 data-original-attrs="{"style":""}" dir="ltr" style="color: rgb(0, 0, 0); font-family: "Times New Roman";">Question</h2><h4 data-original-attrs="{"style":""}" dir="ltr" style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">Given two integers. your task is to find if these integers are friends or not integers considered a friend if both are odd or both are even otherwise they are not friends.<br>Constraints<br>1 <= (a, b) <= 1000<br>Input Format<br>one line contains two integers in this format :<br>a b<br>Output Format:<br>print "homies" without the quotes if they are friends, otherwise print "!homies" without the quotes</h4><div><br></div>
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if((a>0 && a<1001)&&(b>0 && b<1001))
{
if(a%2==0 && b%2==0)
{
cout<<"homies";
}
else if(a%2!=0 && b%2!=0)
{
cout<<"homies";
}
else{
cout<<"!homies";
}
}
else{
cout<<"out of range...";
}
return 0;
}