# Help me in solving CSCV201AB problem

### My code

``````// Update the '_' in the code below to solve the problem
#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
int N,A,B;
cin>>N>>A>>B;
if(N%A ==  0 &&  N%B == 0){
cout<<"N is divisible by A and B"<<endl;
}else if(N%A == 0) {
cout<<"N is divisible by only A"<<endl;
}
else if(N%B == 0 ){
cout<<"N is divisible by only B"<<endl;
}
else if(N%A != 0 && N%B != 0){
cout<<"N is divisible by niether A nor B"<<endl;}
}

return 0;
}

``````

Learning course: C++ for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

@r_its_r
your code is correct it will give correct answer when u just replace the dashes with the correct replacement. like this
// Update the ‘_’ in the code below to solve the problem
include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
int N,A,B;
cin >> N >> A >> B;
if ( N%A == 0 && N%B == 0)
cout << “N is divisible by A and B” << endl;
else if ( N % A == 0)
cout << “N is divisible by only A” << endl;
else if ( N % B == 0)
cout << “N is divisible by only B” << endl;
// The last statement could have been an ‘else’ statement
// else if condition used to show usage of ‘and’ statement
else if( N % A != 0 && N % B != 0)
cout << “N is divisible by neither A nor B” << endl;
}
return 0;
}
no need to add curly braces although adding them won’t create any difference your code is absolutely correct.

my solution is
include <bits/stdc++.h>
using namespace std;

int main() {
int test;
cin>>test;
while(test–)
{
int N,A,B;
cin >> N >> A >> B;
if ( N%A == 0 && N%B == 0){
cout <<“N is divisible by A and B”<<“\n”;
}
if ( N % A == 0){
cout <<“N is divisible by only A”<<“\n”;
}
if ( N % B == 0){
cout <<“N is divisible by only B”<<“\n”;

``````     }
if( N % A != 0 && N % B != 0){
cout<<"N is divisible by neither A nor B"<<"\n";

}
}
return 0;
``````

}