Advertisement
aaronvan

Untitled

Jan 29th, 2019
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. string factors56(int n) {
  2.     ostringstream stream;
  3.    
  4.     if ((n % 5 == 0) && (n % 6 == 0)) {
  5.         stream << n << " is divisible by both 5 and 6";
  6.         return stream.str();
  7.     }
  8.     else if ((n % 5 == 0 || n % 6 == 0) && !((n % 5 == 0) && (n % 6 == 0))) {
  9.         stream << n << " is divisible by 5 or 6, but not both";
  10.         return stream.str();
  11.     }
  12.     else {
  13.         stream << n << " is not divisible by either 5 or 6";
  14.         return stream.str();
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement