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
What is a smooth flow of air over a surface is called?
pochemuha

Answer:

laminar flow

Explanation:

In fluid dynamics, laminar flow is characterized by fluid particles following smooth paths in layers, with each layer moving smoothly past the adjacent layers with little or no mixing.

4 0
3 years ago
Discuss the differences between conduction and convective heat transfer.
FrozenT [24]

Answer:

Basically there are two principal differences between the convection and conduction heat transfer

Explanation:

The conduction heat transfer is referred to the transfer between two solids due a temperature difference, while for, the convective heat transfer is referred to the transfer between a fluid (liquid or gas) and a solid. Also, they used different coefficients for its calculation.

We can include on the explanation that conduction thermal transfer is due to temperature difference, while convection thermal transfer is due to density difference.

8 0
3 years ago
Nancy wants to buy a cooking stove that’s electrically insulated and resistant to heat. What material should she choose for the
astra-53 [7]

Answer:

Ceramics

Explanation:

Ceramics are used to make cooktops if you look it up and according to my engineering and design class ceramics have high heat resistance and melting points, and make good electrical insulators.

3 0
3 years ago
A(n) ____ is an object setting used to control the visible display of objects.
KatRina [158]
Remote?? maybe I’m not really sure
3 0
3 years ago
What is the next measurement after 2' -6" on the architect's scale?
Diano4ka-milaya [45]

Answer: I am not for sure

Explanation:

6 0
3 years ago
Other questions:
  • A gas stream contains 4.0 mol % NH3 and its ammonia content is reduced to 0.5 mol % in a packed absorption tower at 293 K and 10
    14·1 answer
  • A discrete MOSFET common-source amplifier has RG = 2 MΩ, gm = 5 mA/V, ro = 100 kΩ, RD = 20kΩ, Cgs = 3pF, and Cgd = 0.5pF. The am
    15·1 answer
  • Kirchoff's Law states that, by the time current has returned to its source, all
    13·2 answers
  • As an employee, who's is supposed to provide training on the chemicals you are handling or come in contact with at work?
    14·2 answers
  • Note that common skills are listed toward the top, and less common skills are listed toward the bottom.
    14·1 answer
  • can someone help me with this engineering mechanics homework, please? I tried to solve it, but I got so confused.​
    5·1 answer
  • The Ethernet (CSMA/CD) alternates between contention intervals and successful transmissions. Assume a 100 Mbps Ethernet over 1 k
    5·1 answer
  • Determine the average power, complex power and power factor (including whether it is leading or lagging) for a load circuit whos
    9·2 answers
  • Most of the work that engineers do with fluids occurs in nature. True False
    6·1 answer
  • Thoughts on Anime?<br> Whats your fav
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!