#include<stdio.h> #include<stdlib.h> int main(){ int i; while(100){scanf("%d",&i); if (i==42) break; if(i<100&&i>-100) printf("%d\n",i); } return 0; }
I submitted your code as C++ 4.3.2 and it was accepted.
I think while(100) leads to an infinite loop while running. But when i provided custom input as 2 3 42 it gave me correct answer as 2 3 so i feel as u didn’t provide terminating conditioning to it.It keeps on running and leads to a runtime error
The terminating condition is the break when 42 is found.
The code has its faults, but it doesn’t give RE on submission.