#include <stdio.h>
int main() {
int s = 0;
int i = 1;
while (i <= 99) {
printf("%d \n", i);
s += i;
i +=2;
}
printf("%d \n", s);
return 0;
}
运行结果
#include <stdio.h>
int main() {
int s = 0;
int i = 2;
while (i <=100) {
printf("%d \n", i);
s += i;
i+=2;
}
printf("%d \n", s);
return 0;
}
运行结果