Programming Assignment 2
Programming Assignment 2
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.
1. BEGIN
SET lower_limit = 1
SET upper_limit = 100
GENERATE secret_number = RANDOM_NUMBER between
lower_limit and upper_limit
SET attempts = 0
REPEAT
PROMPT "Enter your guess: "
READ guess
INCREMENT attempts by 1