Created
May 9, 2022 19:03
-
-
Save jtprogru/92c5f3f2834e70a060a93eaf19a6a227 to your computer and use it in GitHub Desktop.
Вклад в банке составляет x рублей. Ежегодно он увеличивается на p процентов, после чего дробная часть копеек отбрасывается. Каждый год сумма вклада становится больше. Определите, через сколько лет вклад составит не менее y рублей.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
var x, p, y, counter int | |
_, _ = fmt.Scan(&x) | |
_, _ = fmt.Scan(&p) | |
_, _ = fmt.Scan(&y) | |
for x < y { | |
x += (x * p) / 100 | |
counter += 1 | |
} | |
fmt.Println(counter) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment