程序代码:
#include <STDIO.H> int main() { int sums,squares; int uper,lower; do { printf("enter your uper and lower:"); scanf("%d%d",&uper,&lower); for(sums=0;uper>=lower;lower++) { squares=lower*lower; sums+=squares; } printf("%d\n",sums); } while(lower>uper); return 0; }
你这样循环里面加scanf不就相当于只执行了一次循环吗?另外能不能给代码别给截图...还要打一遍很烦的