Number Guessing Game

I want to generate a number guessing game. Generate a random number between 1-10 and then guess using loops. The loops goes on till the correct number is guessed.

Hi @Trupti1
Welcome to UiPath

Try below easy steps.

  1. AssignrandomNumber = new Random().Next(1, 11)
  2. AssignuserGuess = 0
  3. Do While (userGuess <> randomNumber)
    • Input Dialog"Guess a number between 1-10" → Store in userInput
    • AssignuserGuess = CInt(userInput)
    • If (userGuess < randomNumber) → Message Box "Too low! Try again."
    • ElseIf (userGuess > randomNumber) → Message Box "Too high! Try again."
  4. Message Box"Congratulations! You guessed the right number."

if you found helpful mark as a solution.

1 Like

@Trupti1,

Welcome to the community!

You can use State machine type of workflow for this. Refer this tutorial.

2 Likes

Hey @Trupti1
You can try this:
BlankProcess4.zip (35.3 KB)


2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.