Calculate
Question 3 in the exam
Sample code