1) Let $f: \mathbb{R}\rightarrow \mathbb{R}$ be a continuous function such that $f(r+1/n)=f(r)$ for any rational number $r$ and positive integer $n$. Prove that $f$ is constant.
2) Let $f: \mathbb{R}\rightarrow \mathbb{R}$ be a continuous periodic function of period $1.$ Show that there exist $x_0 \in \mathbb{R}$ such that $f(x_0 +\pi )=f(x_0)$
For 1) I consider $g(x)=f(x+1/n)-f(x)$. Then $g(r)=0$ for every rational $r$ and this imply $g(x)=0$ for every $x$, follows from the continuity of $g$. so we have $f(x+1/n)=f(x)$ for every $x$ and for every $n$. so $f$ is constant.
For 2) I tried with considering the function $g(x)=f(x +\pi)-f(x)$ and try to use Balzano theorem but I failed.
Please verify for the proof of (1) and help me on solving problem (2). thanks
Your proof for (1) looks correct in principle, though a simpler way of putting it would just to be note that the conditions imply that $f$ is a constant function when restricted to the rationals, and continuity means that it is also constant over the reals.
For (2), we can find integers $n$ such that $n\pi$ is arbitrarily close to an integer, and therefore (because $f$ is continuous) such that $f(x + n\pi) - f(x) = \sum_{k=0}^{n-1} g(x + k\pi)$ is arbitrarily close to zero, which is impossible if $g$ is uniformly positive or uniformly negative. The continuity of $g$ and the Intermediate Value Theorem prove the rest.