#include <iostream>
using namespace std;

// 定义阶乘函数fac
int fac(int n) {
    int res = 1;
    for (int i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

int main() {
    // 输入a, b, c的值
    int a, b, c;
    cout << '请输入a, b, c的值:';
    cin >> a >> b >> c;

    // 计算a!+b!+c!的值
    int res = fac(a) + fac(b) + fac(c);

    // 输出结果
    cout << 'a!+b!+c!=' << res << endl;

    return 0;
}
C++ 代码实现求 a! + b! + c! 的值

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

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