Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string factors56(int n) {
- ostringstream stream;
- if ((n % 5 == 0) && (n % 6 == 0)) {
- stream << n << " is divisible by both 5 and 6";
- return stream.str();
- }
- else if ((n % 5 == 0 || n % 6 == 0) && !((n % 5 == 0) && (n % 6 == 0))) {
- stream << n << " is divisible by 5 or 6, but not both";
- return stream.str();
- }
- else {
- stream << n << " is not divisible by either 5 or 6";
- return stream.str();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement