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]
3 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]3 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
1. The NetworkManager or Systemd Networkd components must be installed on a Linux system in order to configure an IP address on
Strike441 [17]

The NetworkManager or Systemd Networkd components must be installed on a Linux system in order to configure an IP address on a network interface: False.

An IP address is an abbreviation for Internet protocol address and it refers to a unique number that is assigned to a computing device or network device, so as to differentiate each computing device from one another in an active network system.

This ultimately implies that, an IP address is typically designed and developed to uniquely identify each computing device or network device that is connected to the Internet or an active network system.

<u>Note:</u> NetworkManager (GUI tool) are configured on desktop computers only while Systemd Networkd are typically configured on servers.

For a Linux system, you don't have to install the NetworkManager or Systemd Networkd before configuring an IP address on a network interface.

Read more: brainly.com/question/20629962

6 0
2 years ago
9.1.3: Printing vector elements with a for loop. Write a for loop to print all NUM_VALS elements of vector courseGrades, followi
svlad2 [7]

Answer:

The program to this question as follows:

Program:

#include <iostream> //defining header file

#include <vector> //defining header file

using namespace std;

int main() //defining main method

{

//defining integer variable NUM_VALS and i.    

int NUM_VALS = 4,i;//assign value in NUM_VALS variable

vector<int> courseGrades(NUM_VALS); //defining vector array

cout<<"Input values: "; //print message

for(i=0;i<NUM_VALS;i++) //loop for input value

{

//input value in verctor array    

cin>>courseGrades[i]; //input from user-end

}

for (i = 0; i < NUM_VALS; i++) //loop to print value

{

cout<<courseGrades[i]<< " ";//print value

}

cout << endl;//for new line

for (i = NUM_VALS-1;i >= 0;i--)//loop to print value in reverse order

{

//print value in reverse order

cout << courseGrades[i] << " "; //print value

}

cout << endl; //for new line

return 0;

}

Output:

Input values: 2

3

5

6

2 3 5 6  

6 5 3 2  

Explanation:

In the above-given code two integer variable "NUM_VALS and i" is declared, in which variable "NUM_VALS" assigns a value, that is 4, in the next step, a vector array "courseGrades" is defined, in which we take input from the user end.

  • In the next step two for loop is declared, in the first loop we simply print the value of the "courseGrades".
  • The second loop is also used to print the "courseGrades" value but, in the reverse order.
8 0
3 years ago
Write a program that prompts the user for a measurement inmeters and then converts it into miles, feet, and inches.
zubka84 [21]

Answer:

Program for measurement in meters and then converts it into miles, feet, and inches:

#include<iostream.h>

#include<conio.h>

void main()

{  float meter, mile, feet, inches;

 cout<<"enter meters";

 cin>>meters";

 feet=meter×3.2808;

 mile= meter×0.000621371;

 inches= meter×39.3701;

cout<<"Value of"<<meter<<"meter"<<"in feet is"<<feet<<"feet":

cout<<"Value of"<<meter<<"meter"<<"in mile is"<<mile<<"mile";

cout<<"Value of"<<meter<<"meter"<<"in inches is"<<inches<<"inches";

getch();

}

8 0
3 years ago
Leo needs to consolidate data in multiple worksheets by performing a calculation across all worksheets on the same cells.
wolverine [178]
A do you think is the answer
4 0
3 years ago
Read 2 more answers
Please help me with Excel!!! A lot of points!
yaroslaw [1]

Answer:

=((SUM(PUT RANGE OF MOTHLY EXPENSES HERE)*12)+SUM(PUT RANGE OF YEARLY EXPENSES HERE))/12

Explanation:

Adds all of the Monthly Expenses : SUM(PUT RANGE OF MOTHLY EXPENSES HERE)

Multiplies the result by 12: *12

Then adds all of the Yearly Expenses to the product of Steps 1 and 2 : SUM(PUT RANGE OF YEARLY EXPENSES HERE)

Divides this new sum by 12: /12

=((SUM(PUT RANGE OF MOTHLY EXPENSES HERE)*12)+SUM(PUT RANGE OF YEARLY EXPENSES HERE)/12)

6 0
3 years ago
Other questions:
  • A person planning to file for bankruptcy must receive credit counseling within two years before filing the petition.
    7·1 answer
  • Part 1 Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Search t
    12·1 answer
  • Write a program that tells what coins to give out for any amount of change from 1
    6·1 answer
  • List and describe the tools for all the main stages of app/application development.
    11·1 answer
  • Effective presentations vary the color scheme on each slide.
    7·2 answers
  • Which method is used for resolving data dependency conflict by the compiler itself?
    6·1 answer
  • An array, numbers, of integers is filled with 100 random numbers whose values are greater than 10 and less than 255. You DO NOT
    7·1 answer
  • true or false You are able to change the formatting of a table after it is inserted into a placeholder.
    6·1 answer
  • A type of attack where the adversary intercepts network packets, modifies them, and inserts them back into the network is called
    13·1 answer
  • PLEASE HELP ME
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!