首页 > 代码库 > for 循环

for 循环

#include <iostream>

int main(){
    int sum = 0;
    for (int val = 0; val <= 10; ++val)
    {
        sum += val;
    }
    std::cout << "0自加到10的值-> " << sum << std::endl;
    return 0;
}

 

for 循环