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
Romashka [77]
3 years ago
8

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
2 answers:
Dahasolnce [82]3 years ago
8 0

Answer:

#include

#include // Enables use of rand()

#include // Enables use of time()

int main(void) {

int seedVal = 0;

seedVal = 4;

srand(seedVal);

cout<< rand()%(int)(149-100+1) + 100;

cout<< rand()%(int)(149-100+1) + 100;

return 0;

}

Explanation:

The code segment starts at line 8 and ends at line 9.

That is:

cout<< rand()%(int)(149-100+1) + 100;

cout<< rand()%(int)(149-100+1) + 100;

The syntax for generating random values in C using rand function is

rand()%(int)(max - min + 1) + min

Or

min + rand()%(int)(max - min + 1).

It works both ways..

Where max and min represent the range of values needed (maximum and minimum)

The random statement can also be used in loops

rosijanka [135]3 years ago
6 0

Answer:

#include <stdlib.h>

#include <time.h>

#include<iostream.h>

int main(void) {

   int seedVal = 0;  

   seedVal = 4;

   srand(seedVal);

  /* Solution*/

  cout<<rand() % 149 + 100<<endl;

  cout<<rand() % 149 + 100<<endl;

  return 0;

}

Explanation:

We start with the required include statements to enable use of srand, rand and time functions. I have also added iostream library to use "cout" function.

After that, the seed is initialized using srand(). And then the two rand functions are called with ranges including and between 100 and 149, and printed out.

You might be interested in
What is a program that translates the information from the web server to a language like HTML into words and pictures that we ca
tresset_1 [31]
The answer is web browser
6 0
3 years ago
What occurs when a company knows enough about a customer's likes and dislikes that it can fashion offers more likely to appeal t
Norma-Jean [14]

Answer:

Personalization

Explanation:

Recommendation systems are becoming a powerful tool in our times today, from only shopping to healthcare provision. One major aspect of Recommender systems is Personalization.

Personalization is a concept of adjusting a service or product to greatly suit the customer. Personalization can be drawn by the information provided by the individual such as location, gender, marital status, etc. or drawn from other inferences retrieved from the customer, such as:

  1. the most clicked service category of a customer,
  2. customer browsing patterns or
  3. services or products previously obtained by a customer.

These inferences retrieved from customers can greatly improve customer satisfaction and get them drawn to the system.

5 0
4 years ago
Smith, Smith, Smith, and Smith is a regional accounting firm that is building a new headquarters building. The building will hav
GuDViN [60]

Answer:

 During the network cable planning and designing the building it helps in reduce the various networking errors as, the various types of errors are mainly occur due to the transmission of the data. The errors in the network is also depend upon the particular type of the circuit.

The network errors can be minimized and reduce by detecting, preventing and also correcting the given errors. By using the cable shield and also preventing the cables from the noise and the power sources and also by improve the quality of the connection, media and the networking equipment in the given network.

4 0
3 years ago
Jason Diaz is a financial advisor who works in an open office with coworkers nearby. Jason advises clients both in person and ov
Elanso [62]

Answer:

There is a need for a microphone and a speaker in the form of a headset for privacy, also, the conventional keyboard and monitor screen. For information security, a configured firewall is recommended to prevent hacking.

Explanation:

Input and output devices are tools used by an operator of a computer device to give instructions and monitor results respectively.

Jason would need a headset, which has a speaker for hearing and a microphone for speaking to the client on a video conference call. These I/O devices are readily available on some personal computers. Every computer system has a keyboard and a monitor, this is also useful for Jason for communicating with his client.

7 0
3 years ago
Write a short program using Python that will:
Alexxx [7]

Answer:

// program in Python to check perfect number

#function to find number is perfect or not

def is_Perfect_Number(n):

   #total variable

   tot = 1

   i = 2

   #sum of all divisor of number

   while i*i<=n:

       if n%i==0:

           tot = tot + i + n/i

       if tot == n and n != 1:

           return 1

       i = i+1  

   return 0

#read until user enter a perfect number

while True:

   #read integer

   num = int(input("Input an integer: "))

   #call the function

   if(is_Perfect_Number(num)):

       print(num,"is perfect number")

       #if perfect number break

       break

   else:

       print(num,"is not a perfect number")

       #ask again

   print("try again.")

Explanation:

Read number from user and then call the function is_Perfect_Number() with  parameter "num".This will find the sum of all divisor of number.If sum is  equal to number then it will return 1 else return 0.If the number is not  perfect then it will again ask to enter a number until user enter a perfect  number.

Output:

Input an integer: 24

24 is not a perfect number                                                                                                

try again.                                                                                                                

Input an integer: 28                                                                                                      

28 is perfect number

6 0
3 years ago
Other questions:
  • What is the name of the process that is used to establish whether or not a user’s identity is legitimate?
    7·1 answer
  • Signs that a listener is paying attention include:
    10·2 answers
  • Object Oriented Programming (OOP) allows us to handle complex code in an organized structure and break down the problem by model
    5·1 answer
  • 4. How can you select non-adjacent cells (i.e. cells that are not all together in one block)?
    5·2 answers
  • If an app needs to perform a derived-class-specific operation on a derived class object reference by a base class variable, the
    9·1 answer
  • You easily can give slides in a presentation a professional and integrated appearance by using a placeholder.
    11·1 answer
  • Chapter 21 discusses four aspects of the speaking situation you should take into account when planning the graphics you'll use i
    15·1 answer
  • Which router feature, when enabled, helps computers on the local network automatically discover and communicate with services pr
    12·1 answer
  • Advantage of realtime processing​
    14·1 answer
  • If a fuse block or holder has tree fuses, it may be termed a...
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!