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]
2 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]2 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
When plotting a single AC cycle beginning at zero degrees and moving forward in time the cycles negative peak occurs at
Lana71 [14]

Answer:A 270 degrees

Explanation:

4 0
3 years ago
What is the force in kN of work done is 1.2 ms moves through 120m​
Semmy [17]

Answer:

\frac{1.2}{120}

0.01

5 0
2 years ago
I have a question.What does DIY mean?
alexdok [17]

Answer: It means "Do it yourself".

Explanation: You're welcome!

6 0
2 years ago
Read 2 more answers
A sinusoidal wave of frequency 420 Hz has a speed of 310 m/s. (a) How far apart are two points that differ in phase by π/8 rad?
Olin [163]

Answer:

a) Two points that differ in phase by π/8 rad are 0.0461 m apart.

b) The phase difference between two displacements at a certain point at times 1.6 ms apart is 4π/3.

Explanation:

f = 420 Hz, v = 310 m/s, λ = wavelength = ?

v = fλ

λ = v/f = 310/420 = 0.738 m

T = periodic time of the wave = 1/420 = 0.00238 s = 0.0024 s = 2.4 ms

a) Two points that differ in phase by π/8 rad

In terms of the wavelength of the wave, this is equivalent to [(π/8)/2π] fraction of a wavelength,

[(π/8)/2π] = 1/16 of a wavelength = (1/16) × 0.738 = 0.0461 m

b) two displacements at times 1.6 ms apart.

In terms of periodic time, 1.6ms is (1.6/2.4) fraction of the periodic time.

1.6/2.4 = 2/3.

This means those two points are 2/3 fraction of a periodic time away from each other.

1 complete wave = 2π rad

Points 2/3 fraction of a wave from each other will have a phase difference of 2/3 × 2π = 4π/3.

8 0
3 years ago
(a) What is the distinction between hypoeutectoid and hypereutectoid steels? (b) In a hypoeutectoid steel, both eutectoid and pr
Gnoma [55]

Answer:

See explanation below

Explanation:

Hypo-eutectoid steel has less than 0,8% of C in its composition.

It is composed by pearlite and α-ferrite, whereas Hyper-eutectoid steel has between 0.8% and 2% of C, composed by pearlite and cementite.

Ferrite has a higher tensile strength than cementite but cementite is harder.

Considering that hypoeutectoid steel contains ferrite at grain boundaries and pearlite inside grains whereas hypereutectoid steel contains a higher amount of cementite, the following properties are obtainable:

Hypo-eutectoid steel has higher yield strength than Hyper-eutectoid steel

Hypo-eutectoid steel is more ductile than Hyper-eutectoid steel

Hyper-eutectoid steel is harder than Hyper-eutectoid steel

Hypo-eutectoid steel has more tensile strength than Hyper-eutectoid steel.

When making a knife or axe blade, I would choose Hyper-eutectoid steel alloy because

1. It is harder

2. It has low cost

3. It is lighter

When making a die to press powders or stamp a softer metals, I will choose hypo-eutectoid steel alloy because

1. It is ductile

2. It has high tensile strength

3. It is durable

7 0
3 years ago
Read 2 more answers
Other questions:
  • A converging - diverging frictionless nozzle is used to accelerate an airstream emanating from a large chamber. The nozzle has a
    15·2 answers
  • What is your employer required to have on fixed ladders that extend more than 24 feet in the workplace?
    15·2 answers
  • A machine raises 20kg of water through a height of 50m in 10secs. What is the power of the machine.​
    5·1 answer
  • What is the command this line of code is telling the robot?
    13·2 answers
  • Most technician jobs in the field of metrology require a college degree. True or False?
    5·2 answers
  • Explain what the ancient Romans did to solve the problem in the following scenario.
    10·1 answer
  • What is anthropology? Discuss the type of anthropology?
    5·2 answers
  • 8. Block A shown in the figure below weighs 2000 N. The chord attached to A passes over a
    9·1 answer
  • A motor takes 38 amperes on a 220-volt circuit. Find the horsepower output (hp) of the motor shown with an efficiency of 90%. Ex
    12·1 answer
  • Reason fo I.EE regulations in electrical installations​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!