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
A building wall has dimensions of 3 m tall and 10 m wide. It is constructed of 2 cm. wallboard (k = 0.5 W/m-C) on the inside, 3
Art [367]

Answer: heat loss through wall is 16.58034kW

Temperature of inside wall surface is 47°c

Temperature of outside wall surface is -2.7°c

Explanation:detailed calculation and explanation is shown in the image below.

4 0
3 years ago
The depletion in the Ozone layer is caused by:
andrew11 [14]
D. Chlorofluorocarbon

This is a man-made carbon that causes the gradual thinning(deception) in the earth’s Ozone layer.

Hope this helped and pls mark as brainliest!

~ Luna
3 0
3 years ago
Read 2 more answers
What is the ANSI B paper size also know as?
krek1111 [17]

Answer:

ANSI A sized paper is commonly referred to as Letter and ANSI B as Ledger or Tabloid.

Explanation:

7 0
3 years ago
can you translate this me gusta el queso :sorry i would have put 300 points buut i used them all for my last question
Irina-Kira [14]
Translate in Spanish: lo siento, hubiera puesto 300 puntos pero los usé todos para mi última pregunta



If you meant a different language lmk
4 0
2 years ago
water flows in a horizontal constant-area pipe; the pipe diameter is 75 mm and the average flow speed is 5 m/s. At the pipe inle
Veronika [31]

Answer:

Head loss = 28.03 m

Explanation:

According to Bernoulli's theorem for fluids  we have

\frac{P}{\gamma _{w}}+\frac{V^{2}}{2g}+z=Constant

Applying this between the 2 given points we have

\frac{P_{1}}{\gamma _{w}}+\frac{V_{1}^{2}}{2g}+z_{1}=\frac{P_{2}}{\gamma _{w}}+\frac{V_{2}^{2}}{2g}+z_{2}+h_{l}

Here h_{l} is the head loss that occurs

\therefore h_{l}=\frac{P_{1}}{\gamma _{w}}+\frac{V_{1}^{2}}{2g}+z_{1}-\frac{P_{2}}{\gamma _{w}}-\frac{V_{2}^{2}}{2g}-z_{2}

Since the pipe is horizantal we have z_{1}-z_{2}=0

Applying contunity equation between the 2 sections we get

A_{1}V_{1}=A_{2}V_{2}\\\\\therefore V_{1}=V_{2}(\because A_{1}=A_{2})

Since the cross sectional area of the both the sections is same thus the speed

is also same

Using this information in the above equation of head loss we obtain

h_{l}=\frac{1}{\gamma _{w}}(P_{1}-P_{2})

Applying values we get

h_{l}=\frac{1}{9810}\times (275\times 10^{3})m\\\\\therefore h_{l}=28.03m

3 0
3 years ago
Other questions:
  • A rectangular workpiece has the following original dimensions: 2a=100mm, h=25mm, and width=20mm. The metal has a strengh coeffic
    8·1 answer
  • A mixture of air and methane is formed in the inlet manifold of a natural gas-fueled internal combustion engine. The mole fracti
    14·1 answer
  • Find the time-domain sinusoid for the following phasors:_________
    6·1 answer
  • Write a static method named fixSpacing that accepts a Scanner representing a file as a parameter and writes that file's text to
    5·1 answer
  • Do YOU have big brain?
    15·2 answers
  • 1. Two technicians are discussing tire rotation. Technician A says that you always follow the tire-rotation procedure outlined i
    14·1 answer
  • A large retirement village has a total retail employment of 120. All 1600 of the households in this village consist of two nonwo
    13·1 answer
  • Select four types of engineers who might be involved in the development of a product such as an iPhone.
    6·2 answers
  • What are the nine Historical periods?
    9·1 answer
  • ____ grinders are used to grind diameters, shoulders, and faces much like the lathe is used for turning, facing, and boring oper
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!