我编写了以下代码,但在编译完成后运行它,没有任何反应.我无法弄清楚它有什么问题.
while循环中有两个"和条件" .当我取出1个条件时,它工作正常,但是当我把两个条件都放进去时,它就不再起作用了.
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter an integer greater than 10: ";
cin >> n;
int c=1;
while ( (c*5 <= n*2) && (c*5 >= n) ) {
cout << c*5 << endl;
c = c+1;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud) c++ ×1