+ 1

What am i doing wrong?(for loop)

I have been trying to solve this challenge from yesterday,its a challenge from "Go" called "how many rabbits" i have attached the challenge details in the code comments.. Errors with the code⚠️ 1) its showing that the variable is undefined,but i have defined it 2) im not getting the case correct... Its showing some absurd result. I have tried many times now but it isnt working☹️ A hint or correction in the code or logic will be highly appreciated.. Thank you https://code.sololearn.com/cbMoB6gSDLvJ/?ref=app

19th May 2021, 8:28 AM
OfcourseitsRohit
OfcourseitsRohit - avatar
3 Antworten
+ 4
package main import "fmt" func main() { var years int fmt.Scanln(&years) p:=7 for i:=1;i<=years; i++{ p*=2 } fmt. Println(p) //your code goes here } //Don't complicate your code
19th May 2021, 9:05 AM
Atul [Inactive]
+ 3
My pleasure
19th May 2021, 11:02 AM
Atul [Inactive]
+ 1
Atul thanks mann!!
19th May 2021, 10:59 AM
OfcourseitsRohit
OfcourseitsRohit - avatar