#include<bits/stdc++.h> using namespace std; int main(){ // [1] 定义变量存储输入的整数n,作为循环的上限 int n; // [2] 读取输入的整数n cin >> n; // [3] 使用for循环遍历1到n的所有整数 for(int i = 1; i <= n; i++){ // [4] 输出当前数字并换行,每行显示一个数 cout << i << endl; } return 0; }
使用您的 Hydro 通用账户