answer.
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
1. Which type of sketch most accurately represents what the finished product will look like?
a_sh-v [17]

Answer:

1. The correct answer is B. Ideations Sketch

2. The correct answer is A. How a product actually works  

Explanation:

1. The correct answer is B. Ideations Sketch

Due to the fact that in the process sketch the idea is to show all the steps that need to be followed to achieve or construct the final product, in the persuasive sketch it is intended to know about the possible influence over the audience and make them want the design notion, in the explanatory sketch what is wanted is to communicate about the structure, function and form in a clear way focusing on how it would be possible to use the product or idea design; and finally in the ideations sketch is used to propose solutions to any concer, in this way the concept is to create a prototype of what the final product would be.  

2. The correct answer is A. How a product actually works  

Because the word function comes from the latin function which means “to perform”. This lead us to define function as the capacity to perform an activity that a product or idea has or what it can do for a consumer or customer.

7 0
2 years ago
The total floor area of a building, including below-grade space but excluding unenclosed areas, measured from the exterior of th
alex41 [277]

Answer:

Gross building area

Explanation:

The Gross building area refers to the entire area of a building covering all the floors. The measurement is expressed in square feet. The Gross building area also includes basements, penthouses, and mezzanines. It is calculated by estimating the exterior dimension of the building. Storage rooms, laundries, staircases are also a part of the gross building area.

6 0
2 years ago
1. A spur gear made of bronze drives a mid steel pinion with angular velocity ratio of 13 /2 : 1. Thepressure angle is 14 1/2° .
Alik [6]

Answer:

Given data

w1/w2=6.5/1

Power=5 KW

wp=1800 rpm

angle=14 degrees

Based on above values,the minimum diameter=30 mm

5 0
2 years ago
The uniform 8–ft board is pushed down into the water so it makes an angle of θ = 30o with the water surface. If the cross sectio
lana66690 [7]

Answer:

The vertical force, F = 19.9 lb.

Explanation:

3 0
2 years ago
An optical mouse originally cost $31.85. Before it was removed from the store, it underwent the following changes in price. 27%
saul85 [17]

Answer:

b.

$43.21

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • Consider a plane composite wall that is composed of two materials of thermal conductivities kA 0.1 W/mK and kB 0.04 W/mK and thi
    14·1 answer
  • What can your employer do to protect you from overhead power lines?
    8·1 answer
  • Current density is given in cylindrical coordinates as J = −106z1.5az A/m2 in the region 0 ≤ rho ≤ 20 µm; for rho ≥ 20 µm, J = 0
    13·1 answer
  • Your assignment is to write a menu driven program. The menu will be responded to using a switch statement. The menu options (cas
    6·1 answer
  • A three-story school has interior column bays that are spaced 25 ft apart in both directions. If the loading on the flat roof is
    7·1 answer
  • Two physical properties that have a major influence on the cracking of workpieces, tools, or dies during thermal cycling are the
    13·1 answer
  • Two resistors of values 7.0 and 15.0 Ω are connected in parallel. This combination in turn is hooked in series with a 3.8- Ω res
    7·1 answer
  • 15. A cold-chamber die-casting machine operates automatically, supported by two industrial robots.The machine produces two zinc
    9·2 answers
  • A rectangular beam having b=300 mm and d=575 mm, spans 5.5 m face to face of simple supports. It is reinforced for flexure with
    14·1 answer
  • Alicia had to get over her fear of heights in order to become comfortable maintaining the generators in wind turbines. professio
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!