Create a program that will prompt the user to enter a number in the range 1-100 to find my favorite number. If the number is less than favorite number, print “Too low...guess again: ”. If the number is greater than favorite number, print “Too high...guess again: ”. Otherwise, indicate that the number entered is the correct favorite number. (use a constant)
Start
Declare constant integer favoriteNumber=8;
Declare integer userFavoriteNumber
Display "Enter a number in the range 1-100 to find my favorite number: "
Input userFavoriteNumber
while userFavoriteNumber<>favoriteNumber:
if userFavoriteNumber<favoriteNumber:
Display "Too low...guess again: "
else
Display "Too high...guess again: "
end if
Input userFavoriteNumber
Display "The number entered is the correct"
Stop
Comments
Leave a comment