如下 C++ 代码如果输入大于 0 的整数,则可以求 1 到 N 之和。

int N, tot; cout << "请输入正整数:";cin >> N;tot = 0; while (N > 0) {   tot += N;   N += -1;}cout << tot;
填写答案