Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int input, d2, d3;
  8. cout << "Input: ";
  9. cin >> input;
  10.  
  11. d2 = input % 2;
  12. d3 = input % 3;
  13. if (input > 0)
  14. {
  15. if (d2 == 0 && d3 == 0)
  16. {
  17. cout << input << " is divisible by 2" << endl;
  18. cout << input << " is divisible by 3" << endl;
  19. }
  20.  
  21. else if (d2 == 0 && d3 != 0)
  22. {
  23. cout << input << " is divisible by 2" << endl;
  24. cout << input << " is not divisible by 3" << endl;
  25. }
  26.  
  27. else if (d2 != 0 && d3 == 0)
  28. {
  29. cout << input << " is not divisible by 2" << endl;
  30. cout << input << " is divisible by 3" << endl;
  31. }
  32.  
  33. else
  34. {
  35. cout << input << " is not divisible by 2" << endl;
  36. cout << input << " is not divisible by 3" << endl;
  37. }
  38. }
  39.  
  40. else
  41. {
  42. cout << "Error!" << endl;
  43. }
  44. }
  45.  
  46. //ken was here eksdee
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement