https://www.codechef.com/CCSTART2/problems/ISBOTH what wronge here in my code

Contest Page | CodeChef :- problem link

my solution : whats wrong here:-

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    bool five = n % 5 == 0, eleven = n % 11 == 0; 
    if(n < 5) cout << "NONE";
    else if(five && eleven)cout << "BOTH";
    else if(five || eleven ) cout << "ONE";
    else "NONE";
    
	return 0;
}

Please format your code :slight_smile:

2 Likes

considered placing cout here?

The trivial mistake clearly shows that a good amount of time was not invested in debugging the code. I would advise you to do the same instead of posting it on the forum straightaway.

In case you need,

your ACfied code
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    bool five = n % 5 == 0, eleven = n % 11 == 0; 
    if(n < 5) cout << "NONE";
    else if(five && eleven)cout << "BOTH";
    else if(five || eleven ) cout << "ONE";
    else cout << "NONE";
    
	return 0;
}

Just put condition in if else-if else ladder it will be AC