Solution: Random Number
Explore building a simple guessing game in C# that generates a random number and allows up to three user attempts to guess it. Learn to control flow with loops, compare numbers, and display feedback messages. This lesson guides you through structuring code with methods to handle random number generation, user input comparison, and game result display, helping you understand practical C# programming fundamentals.
We'll cover the following...
We'll cover the following...
Problem
This exercise uses a random number for a guessing game. Create a console application called Guessing Game that meets the four requirements below.
- Display the following:
Guess the computer’s number between 1 and 10. You have 3 attempts!. - Have the computer select a random number from 1-10.