Try to find the formulas here: https://investoriq.ru/banki/raschet-vklada-s-kapitalizaciej.html  ;
t
n
p%
p
if
for
while
until
max
min
1000 ms 256 Mb Rules for program design and list of errors in automatic problem checking