+ 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
3 odpowiedzi
+ 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
+ 3
My pleasure
+ 1
Atul thanks mann!!