~cpp #include <stdio.h> void main() { int n=1; int sum=0; while(sum<=3000) { sum+=n; n++; } printf("n=%d, sum=%d \n", n, sum); }
~cpp #include <stdio.h> void main() { int n=0; int sum=0; while(sum<=3000) { num++; sum+=n; } printf("n=%d, sum=%d \n", n, sum); }
~cpp sum+=n; n++;
~cpp n++; sum+=n;