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 controller on an electronic arcade game consists of a variable resistor connected across the plates of a 0.227 μF capacitor. T
anyanavicka [17]

Answer:

R min = 28.173 ohm

R max = 1.55 × 10^{4}  ohm

Explanation:

given data

capacitor = 0.227 μF

charged to 5.03 V

potential difference across the plates =  0.833 V

handled effectively = 11.5 μs to 6.33 ms

solution

we know that resistance range of the resistor is express as

V(t) = V_o \times e^{t\RC}    ...........1

so R will be

R = \frac{t}{C\times ln(\frac{V_o}{V})}    ....................2

put here value

so for t min 11.5 μs

R = \frac{11.5}{0.227\times ln(\frac{5.03}{0.833})}

R min = 28.173 ohm

and

for t max 6.33 ms

R max = \frac{6.33}{11.5} \times 28.173  

R max = 1.55 × 10^{4}  ohm

4 0
3 years ago
Two players find themselves in a legal battle over a patent. The patent is worth 20 for each player, so the winner would receive
Alborosie

Answer:

The solution and complete explanation for the above question and mentioned conditions is given below in the attached document.i hope my explanation will help you in understanding this particular question.

Explanation:

5 0
3 years ago
Tech A says you can find the typical angle of a V-block engine by dividing the number of cylinders by 720
Lady_Fox [76]

Answer:

Tech A is correct

Explanation:

Tech A is right as its V- angle is identified by splitting the No by 720 °. Of the piston at the edge of the piston.

Tech B is incorrect, as the V-Angle will be 720/10 = 72 for the V-10 motor, and he says 60 °.

8 0
3 years ago
A completely reversible heat pump produces heat ata rate of 300 kW to warm a house maintained at 24°C. Theexterior air, which is
Triss [41]

Answer:

Change in entropy S = 0.061

Second law of thermodynamics is satisfied since there is an increase in entropy

Explanation:

Heat Q = 300 kW

T2 = 24°C = 297 K

T1 = 7°C = 280 K

Change in entropy =

S = Q(1/T1 - 1/T2)

= 300(1/280 - 1/297) = 0.061

There is a positive increase in entropy so the second law is satisfied.

6 0
3 years ago
Viscous effects are negligible outside of the hydrodynamic boundary layer. (3 points) a. True b. False
Valentin [98]

Answer:

I would say false but I am not for sure

8 0
3 years ago
Other questions:
  • g In the above water treatment facility, chemical concentration (mg/gal) within the tank can be considered uniform. The initial
    8·1 answer
  • Who tryna play fortnite with me
    11·2 answers
  • 1. How many types of pumps are present?​
    14·1 answer
  • What are the two most important things to remember when at the end of your interview?
    6·1 answer
  • A 6-pole, 50 Hz squirrel cage induction motor has rotor resistance and standstill reactance referred to stator of 0.2 ohm and 1
    7·1 answer
  • Write a program that asks the user for the name of a file. The program should display the number of words that the file contains
    7·1 answer
  • Using the data from the table, what is P(3)?!
    9·1 answer
  • At the instant shown car A is travelling with a velocity of 24 m/s and which is decreasing at 4 m/s2 along the highway. At the s
    14·1 answer
  • The figure below appeared three heat treatments processes of steel (A, B and C),
    14·1 answer
  • Jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!