Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int input, d2, d3;
- cout << "Input: ";
- cin >> input;
- d2 = input % 2;
- d3 = input % 3;
- if (input > 0)
- {
- if (d2 == 0 && d3 == 0)
- {
- cout << input << " is divisible by 2" << endl;
- cout << input << " is divisible by 3" << endl;
- }
- else if (d2 == 0 && d3 != 0)
- {
- cout << input << " is divisible by 2" << endl;
- cout << input << " is not divisible by 3" << endl;
- }
- else if (d2 != 0 && d3 == 0)
- {
- cout << input << " is not divisible by 2" << endl;
- cout << input << " is divisible by 3" << endl;
- }
- else
- {
- cout << input << " is not divisible by 2" << endl;
- cout << input << " is not divisible by 3" << endl;
- }
- }
- else
- {
- cout << "Error!" << endl;
- }
- }
- //ken was here eksdee
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement