using namespace std;
int main(){ int N; cin >> N;
if (N%2==1 )
{ cout << "Weird" ;
}
else if (2<= N <= 5 && N%2==0)
{ cout << "Not Weird" ;
}
else if ( 6 <= N <= 20 && N%2==0 )
{ cout << "Weird" ;
}
else if (N >= 20 && N%2==0)
{ cout << "Not Weird" ; }
return 0;
}
This code is printing Not Weird on input of 18.
But it should print Weird I can't figure out where is problem. By the way I am newbie in coding now. So , Please try to explain the solution. Thanks
Aucun commentaire:
Enregistrer un commentaire