This textbook is devoted to formal methods for program verification and is based on the lectures given by the author at CMC MSU, DCAM MIPT, and FCS HSE. It describes the basics of such approaches as deductive analysis and model checking. The list of topics includes formal semantics of programming languages (operational and axiomatic semantics), formal specification of requirements (software contracts and the linear-time temporal logic), methods for proving program correctness (the method of inductive assertions and the method of well-founded sets), and model checking methods (the automata-theoretic approach in the explicit and symbolic forms). The textbook also addresses issues of abstract interpretation, constraint solving, and model-based testing; it provides information on the Frama-C and Spin tools. Each chapter is accompanied by examples and exercises.