#include <iostream>
using namespace std;

int main() {
    int num;
    cin >> num;

    bool divisible_by_3 = (num % 3 == 0);
    bool divisible_by_5 = (num % 5 == 0);
    bool divisible_by_7 = (num % 7 == 0);

    if (divisible_by_3 && divisible_by_5 && divisible_by_7) {
        cout << "3 5 7";
    } else if (divisible_by_3 && divisible_by_5) {
        cout << "3 5";
    } else if (divisible_by_3 && divisible_by_7) {
        cout << "3 7";
    } else if (divisible_by_5 && divisible_by_7) {
        cout << "5 7";
    } else if (divisible_by_3) {
        cout << "3";
    } else if (divisible_by_5) {
        cout << "5";
    } else if (divisible_by_7) {
        cout << "7";
    } else {
        cout << "n";
    }

    return 0;
}
``
描述给定一个整数判断它能否被357整除并输出以下信息: 1、能同时被357整除直接输出3 5 7每个数中间一个空格; 2、只能被其中两个数整除输出两个数小的在前大的在后。例如:3 5或者 3 7或者5 7中间用空格分隔; 3、只能被其中一个数整除输出这个除数; 4、不能被任何数整除输出小写字符‘n’不包括单引号。输入描述输入一行包括一个整数。输出描述输出一行按照描述要求给出整数被3

原文地址: https://www.cveoy.top/t/topic/iQ11 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录