  The aim of this paper is studying the problem of existence of asymptotically
periodic solutions of the scalar differential equation $x'=f(t,x),$ where
$f:\mathbb R\times \mathbb R\to \mathbb R$ is a continuous asymptotically
$\tau$-periodic function. We prove that every bounded on semi-axis $\mathbb
R_{+}$ solution $\varphi$ of this equation is S-asymptotically $\tau$-periodic,
i.e., $\lim\limits_{t\to +\infty}|\varphi(t+\tau)-\varphi(t)|=0$. This
statement is a generalization of the well-known Massera's theorem for
asymptotically periodic scalar differential equations. We also establish a
similar statement for scalar difference equations.
