#include<stdio.h>
int main() {
int n, s, i;
do {
printf("n= "); // here is the problem ?
scanf("%d", &n);
} while (n<100 || n <= 0);
s = 0;
i = 0;
while (i <= n) {
i = i + 2;
s = s + i;
}
printf("s=%d", s);
getchar();
return 0;
}
I ran it in eclipse c/c++ and it not print "n=" first. But when I run it in another IDE like DEV-C++ or VS 2017, it run well. When add this line after printf and I ran like I expected.
fflush(stdout);
What is the problem here ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…