编写程序,使用while循环将50到100的整数相加

 1 #include<iostream>
 2 int main(int argc, char const *argv[])
 3 {
 4     using std::cout;
 5     int a=50,b=50;
 6     while(a<100){
 7       a++;
 8       b=+b+a;
 9     }
10     cout<<b;
11     return 0;
12 }

猜你喜欢

转载自www.cnblogs.com/lIllIll/p/10633221.html