Errors and errors | Sololearn: Learn to code for FREE!

+1

Errors and errors

The population of rabbits at a lab doubles every year. The lab was started initially with 7 rabbits. Your program needs to calculate the number of rabbits you will have after the number of years provided as input.

6/30/2021 5:51:30 PM

Chinmay Anand

8 Answers

New Answer

+2

Chinmay Anand Review the loops lesson just prior to this practice. Start with 7 rabbits. You need to loop years times (get years as an input). Inside the loop double the amount of rabbits (rabbits = rabbits * 2) and set the new amount back to the rabbits variable. After the loop output the amount of rabbits.

+1

rabbits * 2**years

+1

Atul [Inactive] it is simply the formula

0

Post your code here

0

Oma Falk Is this valid in Golang also?

0

0

It is in golang

0

Can someone please help