#include#include int main(){ int sum,k,i; sum=0,k=1; for (i=1; i<=100; i++) { sum=sum+k*i; k=-1*k; } printf("1-2+3-4+5..-100的和为:%dn",sum); return 0; }
欢迎分享,转载请注明来源:内存溢出
#include#include int main(){ int sum,k,i; sum=0,k=1; for (i=1; i<=100; i++) { sum=sum+k*i; k=-1*k; } printf("1-2+3-4+5..-100的和为:%dn",sum); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)