C语言编程1-2+3-4+5-6+~~+99-100用for,语句~while语句……do-whi

日期:2020-03-15 18:39:17 人气:1

C语言编程1-2+3-4+5-6+~~+99-100用for,语句~while语句……do-whi

(1)用for: #include "stdio.h" void main() { int s=0,i=1,j=1; for(;i<=100;i++) { s=s+i*j; j=-j; } printf("1-2+3-4+5-6+~~+99-100=%d",s); } (2)用while: #include "stdio.h" void main() { int s=0,i=1,j=1; whi
    A+
热门评论