酷代码 AI
菜单
服务商

按照由小到大的顺序,输出1∼n之间的所有偶数(c++)

```cpp #include <iostream> using namespace std; int main() { int n; cout << "请输入一个正整数 n: "; cin >> n; for (int i = 2; i <= n; i += 2) { cout << i << " "; } cout << endl; return 0; } ``` [2026-01-16 17:09:14 | AI问答 | 74点数解答]

相关提问
发财导航,免费问AI
实用工具查看更多