All you need to know is that a km is 1000 m ( as the prefix kilo always means 1000 let it be even 1kg and that is equal to 1000g )
also know
that a 100 cm is 1 m and that's cause the prefix centi is 10^–2 (0.01)
answering your question
a) 5km = 5000m
5km and 20m in m is 5000m + 20m = 5020m
b) 13 cm = 13/100m = 0.13m
7m and 12cm is 7m + 0.13m = 7.13m.
remember
1km = 1000m
100cm = 1m
hope this helped :)