Skip to content

Instantly share code, notes, and snippets.

@jtprogru
Created May 9, 2022 19:03
Show Gist options
  • Save jtprogru/92c5f3f2834e70a060a93eaf19a6a227 to your computer and use it in GitHub Desktop.
Save jtprogru/92c5f3f2834e70a060a93eaf19a6a227 to your computer and use it in GitHub Desktop.
Вклад в банке составляет x рублей. Ежегодно он увеличивается на p процентов, после чего дробная часть копеек отбрасывается. Каждый год сумма вклада становится больше. Определите, через сколько лет вклад составит не менее y рублей.
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