I'm seeking a neater proof for the following: Let E [itex]\subseteq[/itex] R. Let every continuous real-valued function on E be bounded. Show that E is compact. I tried to argue based on Heine-Borel theorem as follows: E cannot be unbounded because if it is the case, define f(x)=x on E and f(x) is continuous but unbounded. E cannot be not closed, because E=(0,1] is not closed and we can define f(x)=1/x which is continuous but still unbounded. Thus, E has to be both bounded and closed and hence compact. I think this argument is not very solid and I'd appreciate any hints.