+ 2

W.A.P to check the no. Is divisible by 2 and 3

2nd Oct 2017, 5:54 PM
Satya Rebel
Satya Rebel - avatar
10 ответов
+ 15
I mean there must be another condition for these guys individually
2nd Oct 2017, 7:09 PM
Babak
Babak - avatar
+ 15
Thank you, Ace. so I try to modify you code to see how can I make it work for our little guys!
2nd Oct 2017, 7:12 PM
Babak
Babak - avatar
+ 15
This code is dedicated to my friend Ace. [https://code.sololearn.com/cKWLz9cWL9iY]
2nd Oct 2017, 7:59 PM
Babak
Babak - avatar
+ 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. ;)
2nd Oct 2017, 6:11 PM
Babak
Babak - avatar
+ 13
2 is not divisible by 2. Why is that?
2nd Oct 2017, 7:05 PM
Babak
Babak - avatar
+ 12
Thanks a lot dear Ace for elegant solution.
2nd Oct 2017, 6:44 PM
Babak
Babak - avatar
+ 12
Would you mind to give us a more clear snippet to show your mentioned point?
2nd Oct 2017, 6:57 PM
Babak
Babak - avatar