(1)
# include <stdio.h>
int main()
{int s=0;
int a;
for(a=22;a<=1002;a+=20)
{s=s+a; }
printf("%ld\n",s);
return 0;
}
(2)
#include "stdafx.h"
int main(int argc, char* argv[]) { int s=0; int a=22; while (a<=1002) {s=s+a; a=a+20; } printf("%ld\n",s); return 0; }
(3)
#include "stdafx.h"
int main(int argc, char* argv[]) { int s=0; int a=22; do{s=s+a; a=a+20; } while(a<=1002); printf("%d\n",s);
return 0; }
原文:https://www.cnblogs.com/P201821430010/p/10838921.html