subject

Write a program that simulates an ant trying to crawl up a building of certain height. The ant starts on the ground, at height 0. Each iteration, the ant either crawls up one step, or slips off and falls all the way back to the ground. There is a 50% chance on each iteration that the ant will slip. The program should keep going until the ant gets to the top of the building. It should then print out the number of falls that the ant took before it finally reached the top.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
What is the largest decimal number that can be represented by a binary number with 4 place values? (remember, each place in a binary number has a value of a power of 2, starting in the ones place with 20.)
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Cómo pongo un tomo de llamada sin pagar?
Answers: 1
question
Computers and Technology, 24.06.2019 21:40
Clunker motors inc. is recalling all vehicles in its extravagant line from model years 1999—2002 as well as all vehicles in its guzzler line from model years 2004—2007. a boolean variable named recalled has been declared. given a variable modelyear and a string modelname, write a statement that assigns true to recalled if the values of modelyear and modelname match the recall details and assigns false otherwise.
Answers: 2
You know the right answer?
Write a program that simulates an ant trying to crawl up a building of certain height. The ant start...
Questions
question
Mathematics, 07.12.2020 19:40
question
Mathematics, 07.12.2020 19:40
question
Biology, 07.12.2020 19:40
question
Mathematics, 07.12.2020 19:40
question
Mathematics, 07.12.2020 19:40
Questions on the website: 13722360