提交时间:2024-11-16 23:24:04
运行 ID: 56893
# include <stdio.h> int main(void) { int i; int sum = 0; //sum的英文意思是“总和” for (i=1; i<=100; ++i) //++是自加的意思, ++i相当于i = i + 1 { sum = sum + i; /*等价于sum += i;但是不建议这么写, 因为sum = sum + i看起来更清楚、更舒服*/ } printf("sum = %d\n", sum); return 0; }