40.8k views
4 votes
dam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correct answer. But when Adam tests the program, it always outputs that it took the user one guess, even when it takes many guesses. What error did Adam most likely make, and how should it be fixed?

User Brandrally
by
4.1k points

2 Answers

5 votes

Answer:

Adam had most likely made a logic error.

Step-by-step explanation:

Adam should check his code for any wrong formulas used or wrong arithmetic symbols.

User Udi Cohen
by
4.8k points
5 votes

Answer:

Adam most likely forgot to add a while loop to the guessing code or didn’t add it properly, meaning that instead of letting him guess multiple times it just continues the code, all he needs to do is add a while loop to fix the line of code.

Step-by-step explanation:

hope this helps

User Niggeulimann
by
4.8k points