C# Language
Start by creating a new project, then practice generatingdifferent random numbers and display them at the screen:
Note you only need 1 instance of Random class togenerate these numbers.
Execute the program a few times to make sure the outputs aredifferent each time.
Once you have successfully generated the 3 random numbersdescribed above, add the following enhancements to the program:
Execute the program again, a few times, to make sure thesevalues change on each execution.
This problem combines random number generation with arrays.Using a Random object, write a program that:
declares two arrays of int of size 8,
initializes the values of the first array with random numbersbetween 0 and 9,
initializes the values of second array with random numbersbetween 0 and 9,
displays the contents of the two arrays in a table, and, foreach index, a letter indicating whether the first array “won” or“lost” a contest with the second array:
Write a program that:
Starts by having computer choose a random number between 0 and100. Store that number at a variable.
Asks the user to enter a numerical value between 0 and 100 andstores the user’s answer in a variable.
Add an if statement that displays on the screen "Youguessed correctly" if the number entered by the user matchesthe number selected by computer.
Add an if statement that displays on the screen "Toohigh!" if the number entered by the user is strictly greaterthan the number selected by computer.
Add an if statement that displays on the screen "Toolow!" if the number entered by the user is strictly smallerthan the number selected by computer.
Add an if statement that displays on the screen "You founda multiple !" if the number entered by the user is a multipleof the number selected by computer, but different from it.
When user enters a number that does not match computersselection, the user should be able to enter another number. Thiscontinues until user guesses correctly.
Keep count of how many guesses it takes for the user to arriveto the correct answer.
C# Language Start by creating a new project, then practice generating different random numbers and display them at the s
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am