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
You have a small company and want to keep your costs low, but it is important your employees share data. Which network would pro
Crank

Answer:

centralised

Explanation:

duhh

7 0
3 years ago
Read 2 more answers
I'm 11, except my profile says I'm 15.
aleksandr82 [10.1K]

Answer:

Hello there, I dont think there is a way to change you age, but maybe you shall try again tomorrow and see if an error message pop up.  If the Error Message pops up, contact custumaor support!

Glad I could Help!

3 0
3 years ago
Which type of statement is used to communicate one’s feelings in a nonconfrontational manner?
Elis [28]
A statement with an "I am" phrase could be used to communicate one's feelings in a non-confrontational manner. I hope this answer helps. Have a great day ahead.
5 0
3 years ago
Introduce yourself by following the rule
Mice21 [21]

My name is Trisha Davis, I am a first year medical student and i love to read and write books. I hate lies and i love anyone who is honest.

<h3>What is self introduction?</h3>

My name is Trisha Davis, I am a first year medical student and i love to read and write books. I hate lies and i love anyone who is honest.

My goal in life is to be a medical doctor and also an entrepreneur. I love to help others and put smile on people's face. What  i want from life is good health, favor and avenue to showcase my gifts to the world.

Learn more about self introduction from

brainly.com/question/26685169

#SPJ1

3 0
1 year ago
Which feature of a blog allows an author to interact and get feedback from his or her readers? link pingback commenting TweetMem
poizon [28]
Commenting. When someone comments of a blog the blog's writer can comment back, to answer questions, etc.
6 0
3 years ago
Other questions:
  • A typical serial cable has
    13·1 answer
  • Which payment type is best if you are trying to stick to a budget?
    10·2 answers
  • What type of engineer works on cleaning up oil spills?
    8·2 answers
  • When considering changing the content of a cell which button should you press to leave the cell as it originally was? 
    5·1 answer
  • A function is executed when it is
    7·1 answer
  • Find a 95% confidence interval for the mean failure pressure for this type of roof panel.The article "Wind-Uplift Capacity of Re
    7·1 answer
  • Introduction to computing systems: from bits and gates to c and beyond
    7·1 answer
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • Drag the right word to it’s definition
    13·1 answer
  • The lower band and upper band of integer data type​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!