1 #include "stdafx.h" 2 3 #include<iostream> 4 using namespace std; 5 int main() 6 { 7 8 int sum = 0, n = 1; 9 10 while (n <= 10) { 11 sum = sum + n; 12 ++n; 13 } 14 15 cout << sum << endl; 16 17 system("pause"); 18 return 0; 19 }
while控制语句实现从1到10的求和功能
猜你喜欢
转载自www.cnblogs.com/mengtianwxs/p/9346807.html
今日推荐
周排行