Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 11 Online
OpenStudy (anonymous):

Can u help me fix the error in this program: it should calculate the population of country for the next 3 years, assuming it starts with 1000 people in 2012, and the number of people increases by 10% each year. This is what i have http://pastebin.com/gXFXXDQ6 but it gives me 100 not 1100 for year 2013

OpenStudy (anonymous):

populationIn2012 = 1000 populationIn2013 = populationIn2012 + populationIn2012 * 0.1 populationIn2014 = populationIn2013 + populationIn2013 * 0.1 populationIn2015 = populationIn2014 + populationIn2014 * 0.1

OpenStudy (anonymous):

Great. TY compute. And would it be possible do the same thing by changing just ONE character from populationIn2013 = populationIn2012 * 0.1 to print 1100?

OpenStudy (anonymous):

change to populationin2013 = population2012 * 1.1 and the others consecutively

OpenStudy (anonymous):

TY agrj

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!