Justine - Assignment 2
Justine - Assignment 2
Design an Algorithm
Answer:
START
DEFINE minimum = 1
SET attemptCount = 0
READ inputGuess
INCREMENT attemptCount by 1
ELSE
END IF
END LOOP
END
2. Code Implementation
Task:
o Implement the algorithm you designed in Question 1 using
Javascript
o Your code should:
Generate a random number.
Prompt the user for input.
Provide feedback to the user based on their guess.
Keep track of the number of attempts.
Display the number of attempts taken by the player to
guess the correct number.
ANSWER:
guessCount++;