Let $G=(V,E)$ a graph. Prove that $G$ has no cycles if and only if $G$ has $n-m$ connected components where $n$ is the number of vertices of $G$ and $m$ is the number of edges of $G$.

The thing I did is that since $G$ has no cycles then $ \frac{m}{n} <1$.

Can someone give me some hints-ideas?

Thank's in advance!