Not clicking the logic

i just started coding 2-3 weeks ago but i cant build the logic and my maths is also not good