+ 1
why "--x" gives output until time limit is not exceeded?
2 odpowiedzi
+ 14
#include <iostream>
using namespace std;
int main() {
for(int i = 0; i <= 3; --i)
cout<<"#*";
return 0;
}
In this code, the value of i will always remain below 3 when you subtract it. So it caused an infinite loop and the Sololearn compiler only compiled till the time limit exceeded
+ 3
If you keep subtracting from zero it will always remain <3. So it is an infinite loop where x never >3.