1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Jlenok [28]
3 years ago
13

Write a program that generates a random integer in the range of 1 through 10, and asks the users to guess that the number is. If

the user’s guess is higher than the random number, the program should display "Too high, try again." If the user’s guess is lower than the random number, the program should display "Too low, try again." If the user guesses the number, the application should congratulate the user, then the program should generate a new random number so the game can start over. Until the users enter 0, quit the program.
Computers and Technology
1 answer:
vredina [299]3 years ago
8 0

Answer:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Guessgame

{

   class Program

   {

       static void Main(string[] args)

       {

           //declare variables          

           int random;

           int guess;

           int tries = 0;          

            int quit;

           //Create an instance of Random class

           Random rand = new Random();

           // random number between 1 and 10

           random = rand.Next(10);

           Console.WriteLine("The Guess My Number Game program");

           Console.WriteLine("Enter a guess between 1 and 10");

           guess = Convert.ToInt32(Console.ReadLine());

           while (true)

           {

               //increment the tries by one

               tries++;

             

               //Check if guess is greater than random number

               if (guess > random)

               {

                   //print message

                   Console.WriteLine("Too high, try again.");

                   Console.WriteLine("Enter a guess between 1 and 10");

                   //read guess

                   guess = Convert.ToInt32(Console.ReadLine());

               }

             

               if (guess < random)

               {

                   //print message

                   Console.WriteLine("Too low, try again.");

                   Console.WriteLine("Enter a guess between 1 and 10");

                   //read guess

                   guess = Convert.ToInt32(Console.ReadLine());

               }

             

               //Check if guess is random

               if (guess == random)

               {

                   //print message

                   Console.WriteLine("Congratualations!");

                   Console.WriteLine("Correct! You got it in " + tries + " guesses!");

                   //reset tries to zero

                   tries = 0;

                   Console.WriteLine("Enter a guess between 1 and 10");

                   //read guess from user

                   guess = Convert.ToInt32(Console.ReadLine());

                   // random number between 1 and 10

                   random = rand.Next(10);

               }

                                               

           }//end of while

           quit = Convert.ToInt32(Console.ReadLine());

           if(quit==0)

           end;

       }//end of main

   }

}

You might be interested in
Write a program that prompts the user for two numbers then outputs the result of dividing the first number by the second number
Rainbow [258]

The program is

num = int(input("Enter Numerator "))

den = int(input("Enter Denominator "))

print("quotient is ",str(num//den)," remainder is ", str(num%den))

<h3>How to create a division sign in HTML?</h3>

To create a division sign ( ÷ ) in HTML you can use any of the following codes.

&divide;

&div;

&#247;

<h3>How to divide in computer programming?</h3>

Perl code

use strict;

my $first = 15;

my $second = 5;

my $answer = $first / $second;

print "You get $answer if you divide $first by $second";

When the script above is run, it displays "You get 3 if you divide 15 by 5" on the screen.

To learn more about programming, refer

https://brainly.ph/question/4743

#SPJ4

5 0
2 years ago
In a spreadsheet, there are many features that help you edit quickly. True False
9966 [12]

Answer:

True

Explanation:

There are many form a quick editing

i hoped this helped

;)

7 0
3 years ago
The data structure used for file directory is called
Aleks04 [339]
This is a tough question. I’m not sure if I’ll get it right but I’ll try.

Data structures used for file directories typically have a hierarchical tree structure, referred to as a directory structure. The tree has a root directory, and every file in that system has a unique path.

The simplest method of implementing a directory is to use a linear list of file names with pointers to the data blocks. But another way that you can format a file directory is by using a hash table. With this method, the linear list stores the directory entries, but a hash data structure is also used. The hash table takes a value computed from the file name and return the pointer to the file name any linear list.

So I think it’s C. But I’m not 100% sure.

I hope that helps.
6 0
4 years ago
It would be at least two decades before some of the technologies he demonstrated saw widespread use, but all of them are used by
Phoenix [80]

Answer:

all of the above

Explanation:

7 0
3 years ago
Your friend wants to know about Microsoft Expression Web 4.
Vlad [161]
Microsoft Expression Web 4 is 
--
Component of Expression Studio
--
Design and Develop Web Pages using HTML5, CC3, ASP.Net, and more
--
Requires .Net Framework & Silverlight 4.0
--
3 0
3 years ago
Other questions:
  • These commands are established by combatant commanders when authorized by the Secretary of Defense through the Chairman of the J
    5·1 answer
  • Which protocol is often used to publish web pages to a web server?
    5·1 answer
  • What is credibility in the often-used framework of quality criteria?
    9·1 answer
  • Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow
    8·1 answer
  • What is a Photojournalist
    5·1 answer
  • Read the scenario below and then answer the
    14·1 answer
  • Using symbols (%, $, #, etc.) can make it easier to take notes.
    8·2 answers
  • What is hub.pls ans from pic. for computers​
    9·2 answers
  • What were the names of Henry VIII's six wives?
    9·2 answers
  • What is the difference between a status bar, title bar, and tabs?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!