# How to prove program solves the problem?

I am preparing for the exam on Theory of Programming class. Now I am trying to solve the task from the sample paper:

Given the following problem: A problem is given by its specification:

Let S denote the following program:

Write down the conditions that are sufficient to prove that the given S program solves the given problem. Prove that S is a solution of the given problem. Detailed explanation is required.