0
Can you help me in practice 15.2 golang?
I can not understand how l can do it with "for"?
6 ответов
+ 1
package main
import "fmt"
func main() {
var years int
fmt.Scanln(&years)
//your code goes here
r:=7
for i:=1;i<=years; i++ { r*=2
if i == years {
fmt.Println(r)}
}}
0
You have to make a loop that runs "years" times, doubling the number of rabbits each time.
0
Thank you, I understood that I must write loop, but I can't understand logically how I must do it, I during the days read task and lessons)
0
From lessons I can't understand how l can doubling number
0
This is how you duplicate it Num*=2
And in the "for" you have to change the condition to be executed while the iterator variable (commonly called "i") is less than "the expected number of iterations"
0
Ok, thank you so much, I will try it tomorrow because my brain is going today explain) ( I was trying num*=2,but.,.)