That’s because you have ; after your while.
The ; causes the while loop to run indefinitely without even getting to:
x=x+10;
You may change your code to
while(x < y) {
x = x + 10;
cout << x << " " << y << endl;
}
solved What’s the error in this c++ code?