c++编辑程序求2!+3!+2!*3!的值
时间: 2023-11-27 20:47:13 浏览: 54
第一个C++程序
以下是C++程序求2!+3!+2!*3!的值的例子:
```c++
#include <iostream>
using namespace std;
int main() {
int sum = 0;
int ret1 = 1, ret2 = 1, ret3 = 1;
for (int i = 1; i <= 2; i++) {
ret1 *= i;
}
for (int i = 1; i <= 3; i++) {
ret2 *= i;
}
for (int i = 1; i <= 2; i++) {
ret3 *= i;
}
for (int i = 1; i <= 3; i++) {
ret3 *= i;
}
sum = ret1 + ret2 + ret3;
cout << sum << endl;
return 0;
}
```
输出结果为:32
阅读全文