Reference: CodeChef: Practical coding for everyone
Could someone just figure it out?
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%5==0&&n%11==0)
{
cout<<"BOTH"<<endl;
}
else if(n%5==0||n%11==0)
{
cout<<"ONE"<<endl;
}
else
{
cout<<"NONE"<<endl;
}
return 0;
}
I submitted the code and it shows wrong solution. If cout “ONE” is defined above cout “TWO” and input is assigned a value of 110, it prints “ONE” instead of “BOTH”. I just reversed their order and compiled, the solution comes out to be working well after compiling. But, after submitting the code it shows wrong solution.
I know I am a nerd at it. But, please someone help it out.Preformatted text