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
sweet-ann [11.9K]
4 years ago
11

Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:

Computers and Technology
1 answer:
bogdanovich [222]4 years ago
8 0

C Code:

#include <stdio.h>      // Enables use of printf

#include <stdlib.h>   // Enables use of rand()

#include <time.h>     // Enables use of time()

int main(void)

{

srand(time(0));  

int random1 = rand()% 50 + 100;

int random2 = rand()% 50 + 100;  

printf("%d\n", random1);

printf("%d\n", random2);

  return 0;

}

Output:

115

141

Explanation:

Each time program executes, srand() function generates new random numbers.

rand()%50 + 100 makes sure that number is 2 digit and within the range of 100 to 150.

Then we print the two random numbers where %d represents that we want to print an integer and \n represents new line  

You might be interested in
Pressing the Ctrl+Home keys moves the insertion point to the
mrs_skeptik [129]
For the answer to the question above asking that by <span>Pressing the Ctrl+Home keys moves the insertion point to the?</span>
The answer is A. beginning of a document. 
I assume you are talking about Microsoft Excel 2007 version?
Because it isn't indicated on the question
5 0
3 years ago
Read 2 more answers
Create a script to input 2 numbers from the user. The script will then ask the user to perform a numerical calculation of additi
ohaa [14]

Answer:

The code given is written in C++

First we declare the variables to be used during the execution. The names given are self-explanatory.

Then the program outputs a request on the screen and waits for user input, for both numbers and one more time for the math operation wanted, selected with numbers 1 to 4.

Finally, the program executes the operation selected and outputs the result on screen.  

Code:

<em>#include <iostream> </em>

<em> int main() </em>

<em>{ </em>

<em> // variable declaration </em>

<em> float numberA; </em>

<em> float numberB; </em>

<em> int operation; </em>

<em> float result=0; </em>

<em> </em>

<em> //number request </em>

<em> std::cout<<"Type first number:\n"; std::cin>>numberA; </em>

<em> std::cout<<"Type second number:\n"; std::cin>>numberB; </em>

<em>  </em>

<em> //Operation selection </em>

<em> cout << "Select an operation\n"; </em>

<em> cout << "(1) Addition\n"; </em>

<em> cout << "(2) Subtraction\n"; </em>

<em> cout << "(3) Multiplication\n"; </em>

<em> cout << "(4) Division\n"; </em>

<em> std::cout<<"Operation:\n"; std::cin>>operation; </em>

<em> </em>

<em> switch(operation){ </em>

<em>  case 1: </em>

<em>   result = numberA+numberB; </em>

<em>   break; </em>

<em>  case 2: </em>

<em>   result = numberA-numberB; </em>

<em>   break; </em>

<em>  case 3: </em>

<em>   result = numberA*numberB; </em>

<em>   break; </em>

<em>  case 4: </em>

<em>   result = numberA/numberB; </em>

<em>   break;    </em>

<em>  default: </em>

<em>   std::cout<<"Incorrect option\n"; </em>

<em>  }</em>

<em> //Show result </em>

<em> std::cout<<"Result is:"<<result<<::std::endl; </em>

<em> return 0; </em>

<em>}</em>

5 0
3 years ago
MRS. PAPPAS CP ALG - PERIOD 8<br>My assignments<br>Active<br>FA<br>Past<br>ALL UPCOMING<br>Sensor​
Nat2105 [25]

Answer:

This is a daily schedule for any teacher. It seems he/she wants to enter the details on any calendar.

Explanation:

It seems that XYZ who is a teacher has prepared a schedule for him/her for someday. It is quite confirmed that She/he takes 7 periods. And these are the details of what he/she be doing in each of them. And once he/she gets the Google Calendar ready, he/she will be alerted through a beep or a buzzing sound after each task is accomplished.

5 0
3 years ago
A four-foot by six-foot touch screen is a(n) _____.
Katena32 [7]
Multi-touch interface
5 0
3 years ago
You can access your programs, your documents, your printer, even help from
nirvana33 [79]
 I think it's B. The Start menu.                  
3 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that defines a type for a structure that stores information on a student in ENG EK 125. Declare two variables to
    8·1 answer
  • Describe a function that would take in any RGB value and double its intensity. What do you think happens if the input is 200, 22
    8·1 answer
  • The most common size for a brochure is _____.
    9·1 answer
  • Which of the following is a preferable method to secure wireless access in a SOHO?
    12·1 answer
  • Complex machines are defined by...
    14·2 answers
  • Explain the four misconceptions about entrepreneurship.
    7·1 answer
  • Who is responsible for the actions of autonomous systems? (please help me :C)
    14·2 answers
  • How does the technology affect you daily living? Give situations where you use technology and how it helped you.​
    5·1 answer
  • Online banking is a convenience that mostly affects which area of your life?
    15·1 answer
  • Briefly explain how human thinking is mapped to artificial intelligence components
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!