Let the age of Rakesh be x years.
∴ Sania’s age = (x + 5) years.
According to the given condition,
x + (x + 5) = 27
∴ 2x + 5 = 27
∴ 2x = 27 – 5
∴ 2x = 22
∴ x = 22/2 = 11
∴ Sania’s age = x + 5 = 11 + 5 = 16 years
∴ The ages of Rakesh and Sania are 11 years and 16 years respectively.