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
Andreyy89
3 years ago
8

Write a Raptor program that will generate a random number between 1 and 100; do not display the randomly generated number. Let t

he user guess within 3 tries what the random number is. Display appropriate messages based on each try, for example, "1 remaining try" or "You guessed correctly!"
Computers and Technology
2 answers:
zepelin [54]3 years ago
8 0

Answer:

Explanation:

Let's do this in Python, we can first generate the random number from 1 to 100. Then compare that with the input number from the guesser.

from random import random

random_0_1 = random()

random_1_100 = 1 if round(100*random_0_1) < 1 else round(100*random_0_1)

for trial in range(3):

    guess = input('Guess the number: ')

    if guess == random_1_11:

         print('You guessed correctly!')

         break

    else:

         print(2 - trial + " remaining try")

tekilochka [14]3 years ago
4 0

Answer:

The answer to this question can be given as:

Program:

#include <stdio.h>  //include header file.

#include <stdlib.h> //include header file.

int main ()  //main method.

{

 int number,choice;  //define variable.

 number = rand() % 10 + 1; //use random function and take value in number variable

 for(int i=1;i<=3;i++)  //loop for 3 time input.  

 {

   printf ("\n Enter the Guess number between 1 to 10 :\n"); //message

   scanf ("%d",&choice); //input a number

   if (number<choice)  //check number

   {

   printf("Number is to lower\n try= %d",i); //message

   }

   else if (number>choice) //check number

   {

   printf("Number is to higher\n try= %d",i);   //message

   }

   else if(number==choice ||number!=choice)  //check number

   {

       printf("Congratulations...! \n You guessed correctly!\n");  //message

       break;

   }

 }

   printf("\n Number is :%d\n",number);  //value

 return 0;

 }

Output:

Enter the Guess number between 1 to 10 :

5

Number is to lower

try= 1

Enter the Guess number between 1 to 10 :

8

Number is to lower

try= 2

Enter the Guess number between 1 to 10 :

6

Number is to lower

try= 3

Number is: 4

Explanation:

The above C language program can be described as:

  • In this program firstly we include header files.  Then we define the main function in this function we define a variable that is number and choice. The number variable holds the value of the random number that is taken by the rand function.
  • Then we define the loop. This loop is used to provide input validation. This means the user input number only three times. In this loop, we take input by the user in the choice variable.  
  • Then we use the conditional statement. In this statement, we check the numbers. If the value match in 3 inputs so, it will print the message "Congratulations...! You guessed correctly!". Otherwise, we will print the random function value.
You might be interested in
The hardware and software that must be implemented to support the applications that the primary activities use are a part of the
Contact [7]
The answer is infrastructure
7 0
2 years ago
Edhisive 3.5 code practice
Amanda [17]

Answer:

x = int(input("What grade are you in? "))

if (x == 9):

   print ("Freshman")

elif (x == 10):

   print("Sophomore")

elif (x == 11):

   print ("Junior")

elif (x == 12):

   print("Senior")

else:

   print ("Not in High School")

Explanation:

7 0
2 years ago
Due to a fire at ABC Software Solutions, all
zaharov [31]

Answer:

chaos among people who worked in the company.

6 0
1 year ago
What are the required components of a database function? ​
vagabundo [1.1K]

Answer:

Following are the required components of a database function :-

  • Software
  • Data
  • Hardware
  • Procedures
  • Data Manager
  • Database Access language
  • Query processor

hope it helps!

5 0
3 years ago
Several students are making presentations for a science class. The chart describes the concept that each student will present to
Sedbober [7]

Question

Student presentation concepts from another source

Letitia - a step-by-step process of breaking down glucose into energy

Mana - repeating process of the steps of the cell division, going from interphase to division, and back to interphase.

Paul - a series of organisms that show similar characteristics and compare them to those that do not

Which best describes the SmartArt graphic layout each student should use?

Answer:

Letitia would use a process, Maria would use a cycle, and Paul would use a relationship.

Explanation:

Letita's assignment requires her to show how glucose can be broken down into energy, this requires a series of steps in s linear fashion, meaning it would be best suited to a process-style diagram.

Marta's project involves showing the steps of the cell cycle: the clue is in the name. This process is not linear, and instead repeats itself, meaning it fits to a cycle diagram (i.e. a circular diagram)

Paul is comparing and contrasting different organisms. Therefore, he should use a relationship diagram to show shared characteristics as well as features that differ.

4 0
3 years ago
Other questions:
  • Which of the following characters at the beginning of a cell signifies to Excel that it should perform a calculation for the val
    13·1 answer
  • What are the advantages and disadvantages to a home user of replacing dial-up Internet access with broadband?
    15·1 answer
  • Does anyone know how to cancel a Pandora Free Trial Subscription? I need to cancel it by tomorrow. Please help!
    12·1 answer
  • What are some characteristics of filtering junk email in Outlook 2016? Check all that apply.
    9·2 answers
  • what is the gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    7·2 answers
  • How is actual cost calculated?<br><br> Please answer
    12·1 answer
  • In modern web design, color, font, font size, and style should be declared using:
    5·1 answer
  • "What line of code can be used to provide a convenient way to merge the source code from one file with the source code in anothe
    8·1 answer
  • Mobile apps are replacing the old__________<br><br>​
    7·2 answers
  • One limitation of high-level programming languages is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!