You are on page 1of 1

Lab 01: Recap 0

EXERCISE 1
Write a program that calculates the age of a person whose year of birth is entered through the
keyboard.

EXERCISE 2
Write a program which calculates the last term and the sum of terms of an arithmetic progression
(i.e., series of consecutive numbers separated by the same deviation), knowing the first term a,
the reason r, and the number of terms n. We consider that the last term of the progression is
given by an = a + (n+1)r and the sum of terms is given by S = n/2 (2a + (n-1)r).

EXERCISE 3
Write a program that asks for the unit price and quantity of an item then displays an invoice in
the following form :
Total price excluding VAT = ...
Tax = ...
Total price (tax included) = ...
Knowing that the tax is worth 12.5%.

EXERCISE 4
Write a program that takes a 3 digit number from the user and calculates the sum of its digits .
For example : 452 → 4+5+2=11

EXERCISE 5
Write a program that takes a 3 digit number from the user and displays its mirror image number.
For example : 452 → 254

You might also like