+ 2
W.A.P to check the no. Is divisible by 2 and 3
7 Answers
+ 15
I mean there must be another condition for these guys individually
+ 15
Thank you, Ace. so I try to modify you code to see how can I make it work for our little guys!
+ 15
This code is dedicated to my friend Ace.
[https://code.sololearn.com/cKWLz9cWL9iY]
+ 13
#include <iostream>
using namespace std;
int main()
{
int input = 0;
cout << "Your number is: "; cin >> input;
if (input % 6 != 0) {
if (!(input % 2 && input % 3)) cout << input << " is divisable by 2 OR 3.";
}
else cout << input << " is divisable by both 2 AND 3.";
}
Thanks Ace for pointing out to my mistake. ;)
+ 13
2 is not divisible by 2. Why is that?
+ 12
Thanks a lot dear Ace for elegant solution.
+ 12
Would you mind to give us a more clear snippet to show your mentioned point?