This question is perfect example of the limits of forums such as this.

We do not know what tools & background you have to help you.

On one level it is almost trivial.

Suppose that is a proper subset of real numbers which is both open and closed.

Then but would also be open because is closed.

That is a contradiction to the fact that is a connected space being the union of two nonempty disjoint open sets.

But do you have that result to use?