-
循環嵌套
鎖定
- 中文名
- 循環嵌套
- 分 類
- 邏輯程序中的方法
舉例
#include<iostream>//這是c++版的格式 using namespace std; int main() { int c=0; for(int i=0;i<=10;i++) { for(int t=0;t<=10;t++) { c=c+t+i; cout<<c<<endl; } } } 具體結果如下0 1 3 6 10 15 21 28 36 45 55 56 58 61 65 70 76 83 91 100 110 121 123 126 130 135 141 148 156 165 175 186 198 201 205 210 216 223 231 240 250 261 273 286 290 295 301 308 316 325 335 346 358 371 385 390 396 403 411 420 430 441 453 466 480 495 501 508 516 525 535 546 558 571 585 600 616 623 631 640 650 661 673 686 700 715 731 748 756 765 775 786 798 811 825 840 856 873 891 900 910 921 933 946 960 975 991 1008 1026 1045 1055 1066 1078 1091 1105 1120 1136 1153 1171 1190 1210 -------------------------------- Process exited with return value 0 Press any key to continue . . .