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
Neko [114]
3 years ago
9

Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment

with a row of mailboxes in the post office. These mailboxes were numbered 1 through 150, and beginning with mailbox 2, he opened the doors of all the even-numbered mailboxes, leaving the others closed. Next, beginning with mailbox 3, he went to every third mail box, opening its door if it were closed, and closing it if it were open. Then he repeated this procedure with every fourth mailbox, then every fifth mailbox, and so on. When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.
Engineering
1 answer:
aleksandrvk [35]3 years ago
7 0

Answer:

//This Program is written in C++

// Comments are used for explanatory purpose

#include <iostream>

using namespace std;

enum mailbox{open, close};

int box[149];

void closeAllBoxes();

void OpenClose();

void printAll();

int main()

{

closeAllBoxes();

OpenClose();

printAll();

return 0;

}

void closeAllBoxes()

{

for (int i = 0; i < 150; i++) //Iterate through from 0 to 149 which literarily means 1 to 150

{

box[i] = close; //Close all boxes

}

}

void OpenClose()

{

for(int i = 2; i < 150; i++) {

for(int j = i; j < 150; j += i) {

if (box[j] == close) //Open box if box is closed

box[j] = open;

else

box[j] = close; // Close box if box is opened

}

}

// At the end of this test, all boxes would be closed

}

void printAll()

{

for (int x = 0; x < 150; x++) //use this to test

{

if (box[x] = 1)

{

cout << "Mailbox #" << x+1 << " is closed" << endl;

// Print all close boxes

}

}

}

Explanation:

You might be interested in
an electric circuit includes a voltage source and two resistances (50 and 75) in parallel. determine the voltage source required
ASHA 777 [7]

Answer:

The voltage source required to provide 1.6 A of current through the 75 ohm resistance is 120 V.

Explanation:

Given;

Resistance, R₁ = 50Ω

Resistance, R₂ = 75Ω

Total resistance, R = (R₁R₂)/(R₁ + R₂)

Total resistance, R = (50 x 75)/(125)

Total resistance, R = 30 Ω

According to ohms law, sum of current in a parallel circuit is given as

I = I₁ + I₂

I = \frac{V}{R_1} + \frac{V}{R_2}

Voltage across each resistor is the same

1.6 = \frac{V}{R_2}  

V = 1.6 x R₂

V = 1.6 x 75

V = 120 V

Therefore, the voltage source required to provide 1.6 A of current through the 75 ohm resistance is 120 V.

This voltage is also the same for 50 ohms resistance but the current will be 2.4 A.

3 0
3 years ago
Read 2 more answers
Joe, a technician, is attempting to connect two hubs to add a new segment to his local network. He uses one of his CAT5 patch ca
mart [117]

Answer:

Option D. is correct

Explanation:

Joe uses one of his CAT5 patch cables to connect two hubs to add a new segment to his local network. As he can only connect to it from a workstation within that segment,  he is not able to reach the new network segment from his workstation.

The most problem is that the technician used a straight-through cable.

Option D. is correct.

3 0
3 years ago
What is the function of the rotor and the stator in an AC motor
sweet-ann [11.9K]
The rotor is situated inside the stator and is mounted on the AC motor's shaft. It is the rotating part of the AC motor. And while we know this, the major function of the rotor and the stator is helping the motor shaft rotate.
7 0
4 years ago
The typical measurement of hotel demand is the room night (RN). When we say that each room night is perishable , we mean that on
Marta_Voda [28]

Answer:

Yes once a room is not rented for a couple of hours in the night then it is perishable.

8 0
3 years ago
(20 points) (Assessment of Outcome 1): A plant has two identical standby generator units for emergency use. In the area of the g
erastovalidia [21]

Answer:

It wouldn't get any louder then maybe 3db more

Explanation:

There's even a equation if you wanted to check this out but, if they are the same generator same model and all and made the same precise noise it wouldn't increase more then 3db.

5 0
4 years ago
Other questions:
  • Naturally, it would be nice to convert the entire output of make-change to the RLE format. Write a SCHEME function (rle-all lcoi
    14·1 answer
  • The three resistors in the circuit shown have values of 4ohms 4ohms and 2ohms. The battery has a value of 12 volts. What is the
    11·1 answer
  • The density of a liquid is to be determined by an old 1-cm-diameter cylindrical hydrometer whose division marks are completely w
    6·1 answer
  • At a given point in a supersonic wind tunnel, the pressure and temperature are 5×104 N/m2 and 200 K, respectively. The total pre
    12·1 answer
  • Which of the following is not a step in a building’s life cycle?
    6·1 answer
  • Select the correct answer.
    12·1 answer
  • Which option identifies the tool best to use in the following scenario?
    13·1 answer
  • 1. How is high-speed internet typically transmitted around the world? over telephone wires b. through fiber optic cables c. beam
    9·2 answers
  • The mechanical energy of an object is a combination of its potential energy and its
    5·1 answer
  • What are the three major costs of owning a vehicle throughout a year?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!