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
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all th
Whitepunk [10]

Answer:

Following are the statement in C++ Language is given below

total=0; // variable declaration

cin >> amount; // Read the input

while(amount >=0) //iterating the loop

{

if(amount>0) // checking condition

total=total+amount; // perform operation

}

Explanation:

Following is the description of the statement

  • Declared a variable "total" and initialized with them 0 to them.
  • Read the input in the "amount" variable by using cin.
  • iterating the loop when the amount is greater then 0.
  • Checking the condition if(amount>0) then adding the total variable and amount and storing them into the total variable.

8 0
3 years ago
Input two numbers and print their sum products difference division and remainder​
likoan [24]

\tt n1=int(input("Enter\: first\:no:"))

\tt n2=int(input("Enter\: second\:no:"))

\tt sum=n1+n2

\tt diff=n1-n2

\tt pdt=n1*n2

\tt div=n1//n2

\tt rem=n1\%n2

\tt print("Sum=",sum)

\tt print("Difference=",diff)

\tt print("Product=",pdt)

\tt print ("Division=",div)

\tt print("Remainder=",rem)

Output:-

Enter first no:4

Enter second no:3

Sum=7

Difference=1

Product=12

Division=1

Remainder=1

7 0
2 years ago
You are part of the team to implement new software at XYZ Inc. The employees at XYZ Inc. trust the results of the old software p
sasho [114]

Answer:

Option (D) i.e., Parallel start up is correct option to the following question.

Explanation:

Parallel startup is also an application or software or a way of using the application of the other Operating System in others just like that the following XYZ inc. has trust on older platform but their system give them cautions for update then they use parallel set up by which they also use old software, as well as they, use the Mac's software in Windows. This strategy provides both the option of usage.

8 0
3 years ago
Hi! This is python coding. Please don't take advantage, actually, answer!
Greeley [361]

Answer:

Try and do number = 7

If that does not work then I dont know what to tell you.

Explanation:

8 0
3 years ago
What is the use of consonant in QBASIC ? Answer me in short and easy answer.​
Digiron [165]

Answer:

See Explanation

Explanation:

I'll assume the question is about the use of constants in QBasic because consonants do not have any special function or usage in QBasic.

In simple terms: In QBasic, constants are used to represent elements that do not change in value during program execution.

Take for instance, you intend to use \pi in your program.

Its value is \pi = 3.142

So, 3.142 will always be a constant in your program. One of the ways it can be used in a program is:

10 LET PI = 3.142

<em>The above represents a numeric constant. QBasic also have string constants.</em>

3 0
3 years ago
Other questions:
  • Informs the network interface card to pass packets sent to that address to the ip stack so their contents can be read, and tells
    9·1 answer
  • Your company is instituting a new security awareness program. You are responsible for educating end users on a variety of threat
    10·1 answer
  • Which type of drawer has three dispensing modes: single-dose, multi-dose, and matrix?
    13·1 answer
  • How is a cell named in microsoft excel 2016
    10·1 answer
  • Which type of optical scanner works in a manner similar to a copy machine?
    15·1 answer
  • Which of the following is not considered format?
    8·2 answers
  • How do i delete an account for brainly how do i delete everything
    7·2 answers
  • My brainly isnt working it isnt showing and answers wats going on? wat do i do
    14·2 answers
  • Why is it a good idea not to change the subject line when replying to a message?
    8·2 answers
  • What happened to the ten commandments tablets.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!