为什么cout跳出和不跳出循环答案不一样如图

img

img


#include <iostream>
using namespace std;
int main()
{
    int c;
    int a, b;
    for(a=0;a<=9;a++)
        for (b = 0; b <= 9; b++)
        {
            c = 60000 + 7000 + a * 100 + b * 10 + 8;
            if (c % 78 == 0 && c % 67 == 0)
            cout << c;
        }
    return 0;
}
```c++


```

第二个代码if里面什么都没做,所以程序从0扫描到9,最后a和b的值都是9,所以输出67998
有帮助望采纳~

跳出的那个是不满足你那个if条件的,它是for循环结束前得到的最后一个c