<?php
$target = 1000000; /* цель */
$balance = 10000; /* вклад */
$percent = 1.10; /* проценты */
$yearsOld = 16; /* возраст */
for ($years = 1; $years<= 100; $years++) {
$balance = $balance * $percent;
$yearsOld = $yearsOld + 1;
if ($balance >= $target) {
echo "прошло лет = {$years}, возраст = {$yearsOld}, выплачено = {$balance}";
break;
}
}
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgokdGFyZ2V0ID0gMTAwMDAwMDsgLyog0YbQtdC70YwgKi8KJGJhbGFuY2UgPSAxMDAwMDsgLyog0LLQutC70LDQtCAqLyAKJHBlcmNlbnQgPSAxLjEwOyAvKiDQv9GA0L7RhtC10L3RgtGLICovCiR5ZWFyc09sZCA9IDE2OwkvKiDQstC+0LfRgNCw0YHRgiAqLwoKZm9yICgkeWVhcnMgPSAxOyAkeWVhcnM8PSAxMDA7ICR5ZWFycysrKSB7CgkkYmFsYW5jZSA9ICRiYWxhbmNlICogJHBlcmNlbnQ7CgkkeWVhcnNPbGQgPSAkeWVhcnNPbGQgKyAxOwoJCglpZiAoJGJhbGFuY2UgPj0gJHRhcmdldCkgewoJCWVjaG8gItC/0YDQvtGI0LvQviDQu9C10YIgPSAgeyR5ZWFyc30sINCy0L7Qt9GA0LDRgdGCID0geyR5ZWFyc09sZH0sINCy0YvQv9C70LDRh9C10L3QviA9IHskYmFsYW5jZX0iOwoJCWJyZWFrOwoJfQp9