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.

Answers

Answer 1
Answer:

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:


Related Questions

Steam enters a turbine from a 2 inch diameter pipe, at 600 psia, 930 F, with a velocity of 620 ft/s. It leaves the turbine at 12 psia with a quality of 1.0, through an outlet duct 1 ft in diameter. Calculate the turbine power output
What is the function of deaerator in thermal power plant? ​
Imagine you have been asked to find the following object pictured on the left in the accompanying array on the right.RED AND WHITE SQUARES ALL LOOK SIMILARWhat type of search do you think this would be?
In a refrigerator, heat is transferred from a lower-temperature medium (the refrigerated space) to a higher-temperature one (the kitchen air). Is this a violation of the second law of thermodynamics
What is the deflection equation for a simply supported beam with a uniformly distributed load?

. Were you able to observe ???? = 0 in the circuit you constructed during lab? Why or why not? Hint: What value of resistance would be needed for ???? = 0? 2. What feature in the time response of an RLC circuit distinguishes a critically damped response from an underdamped response? 3. Why must an op-amp be powered to be used in a circuit? 4. If you were handed a parts kit with an unknown op-amp, what information would you need to find prior to using it in a circuit?

Answers

Answer:

an attachment is below

Explanation:

1) the formula for damping coefficient id for RLC series circuit.

For \xi =0 you can make c=0 but inductor will still have some capacitance.

2) the responses of critically damped system and under damped system are shown with comments on their time response.

4) There can be many different answers to this question, but the 4 I have mentioned are the most important parameters we need to know about an unknown op-amp if we are to use it in our circuit.

Hope it answers all your questions.

Find the minimum sum of products expression using Quine-McCluskey method of the function. F(A,B,C,D)= Σ m(1,5,7,8,9,13,15)+ Σ d(4,6,11)

Answers

Answer:

Digital electronics deals with the discrete-valued digital signals. In general, any electronic system based on the digital logic uses binary notation (zeros and ones) to represent the states of the variables involved in it. Thus, Boolean algebraic simplification is an integral part of the design and analysis of a digital electronic system.

Explanation:

Hi please follow me also I you can and thanks for the points. Have a good day.

An industrial load with an operating voltage of 480/0° V is connected to the power system. The load absorbs 120 kW with a lagging power factor of 0.77. Determine the size of the capacitor in vars that is necessary to raise the power factor to 0.9 lagging.

Answers

Answer:

Q=41.33 KVAR\ \nat\n\ 480 Vrms

Explanation:

From the question we are told that:

Voltage V=480/0 \textdegree V

Power P=120kW

Initial Power factor p.f_1=0.77 lagging

Final Power factor p.f_2=0.9 lagging

Generally the equation for Reactive Power is mathematically given by

Q=P(tan \theta_2-tan \theta_1)

Since

p.f_1=0.77

cos \theta_1 =0.77

\theta_1=cos^(-1)0.77

\theta_1=39.65 \textdegree

And

p.f_2=0.9

cos \theta_2 =0.9

\theta_2=cos^(-1)0.9

\theta_2=25.84 \textdegree

Therefore

Q=P(tan 25.84 \textdegree-tan 39.65 \textdegree)

Q=120*10^3(tan 25.84 \textdegree-tan 39.65 \textdegree)

Q=-41.33VAR

Therefore

The size of the capacitor in vars that is necessary to raise the power factor to 0.9 lagging is

Q=41.33 KVAR\ \nat\n\ 480 Vrms

Assignment 1: Structural Design of Rectangular Reinforced Concrete Beams for Bending Perform structural design of a rectangular reinforced concrete beam for bending. The beam is simply supported and has a span L=20 feet. In addition to its own weight the beam should support a superimposed dead load of 0.50 k/ft and a live load of 0.65 k/ft. Use a beam width of 12 inches. The depth of the beam should satisfy the ACI stipulations for minimum depth and be proportioned for economy. Concrete compressive strength f’c = 4,000 psi and yield stress of reinforcing bars fy = 60,000 psi. Size of stirrups should be chosen based on the size of the reinforcing bars. The beam is neither exposed to weather nor in contact with the ground, meaning it is subjected to interior exposure.
• Use the reference on "Practical Considerations for Rectangular Reinforced Concrete Beams"
• Include references to ACI code – see slides from second class
• Include references to Tables from Appendix A
• Draw a sketch of the reinforced concrete beam showing all dimensions, number and size of rebars, including stirrups.

Answers

Answer:

Beam of 25" depth and 12" width is sufficient.

I've attached a detailed section of the beam.

Explanation:

We are given;

Beam Span; L = 20 ft

Dead load; DL = 0.50 k/ft

Live load; LL = 0.65 k/ft.

Beam width; b = 12 inches

From ACI code, ultimate load is given as;

W_u = 1.2DL + 1.6LL

Thus;

W_u = 1.2(0.5) + 1.6(0.65)

W_u = 1.64 k/ft

Now, ultimate moment is given by the formula;

M_u = (W_u × L²)/8

M_u = (1.64 × 20²)/8

M_u = 82 k-ft

Since span is 20 ft, it's a bit larger than the average span beams, thus, let's try a depth of d = 25 inches.

Effective depth of a beam is given by the formula;

d_eff = d - clear cover - stirrup diameter - ½Main bar diameter

Now, let's adopt the following;

Clear cover = 1.5"

Stirrup diameter = 0.5"

Main bar diameter = 1"

Thus;

d_eff = 25" - 1.5" - 0.5" - ½(1")

d_eff = 22.5"

Now, let's find steel ratio(ρ) ;

ρ = Total A_s/(b × d_eff)

Now, A_s = ½ × area of main diameter bar

Thus, A_s = ½ × π × 1² = 0.785 in²

Let's use Nominal number of 3 bars as our main diameter bars.

Thus, total A_s = 3 × 0.785

Total A_s = 2.355 in²

Hence;

ρ = 2.355/(22.5 × 12)

ρ = 0.008722

Design moment Capacity is given;

M_n = Φ * ρ * Fy * b * d²[1 – (0.59ρfy/fc’)]/12

Φ is 0.9

f’c = 4,000 psi = 4 kpsi

fy = 60,000 psi = 60 kpsi

M_n = 0.9 × 0.008722 × 60 × 12 × 22.5²[1 - (0.59 × 0.008722 × 60/4)]/12

M_n = 220.03 k-ft

Thus: M_n > M_u

Thus, the beam of 25" depth and 12" width is sufficient.

In a TDM communication example, 15 voice signals are badlimited to 5kHz and transmitted simultaneously using PAM. What is a preliminary estimate for the required system bandwidth?(a) 10 kHz
(b) 75 kHz
(c) 80 kHz
(d) 160 kHz
(e) None of the above.

Answers

Answer:

Option D

160 kHz

Explanation:

Since we must use at least one synchronization bit, total message signal is 15+1=16

The minimum sampling frequency, fs=2fm=2(5)=10 kHz

Bandwith, BW required is given by

BW=Nfs=16(10)=160 kHz

At full load, a commercially available 100hp, three phase induction motor operates at an efficiency of 97% and a power factor of 0.88 lag. The motor is supplied from a three-phase outlet with a line voltage rating of 208V.a. What is the magnitude of the line current drawn from the 208 V outlet? (1 hp = 746 W.) b. Calculate the reactive power supplied to the motor.

Answers

Answer:

I = Line Current = 242.58 A

Q = Reactive Power = 41.5 kVAr

Explanation:

Firstly, converting 100 hp to kW.

Since, 1 hp = 0.746 kW,

100 hp = 0.746 kW x 100

100 hp = 74.6 kW

The power of a three phase induction motor can be given as:

P_(in)  = √(3) VI Cos\alpha\n

where,

P in = Input Power required by the motor

V = Line Voltage

I = Line Current

Cosα = Power Factor

Now, calculating Pin:

efficiency = \frac{{P_(out)} }{P_(in) }\n0.97 = (74.6)/(P_(in) ) \nP_(in) = (74.6)/(0.97)\n  P_(in) = 76.9 kW

a) Calculating the line current:

P_(in) = √(3)VICos\alpha   \n76.9 * 1000= √(3)*208*I*0.88\nI = (76.9*1000)/(√(3)*208*0.88 )\nI =   242.58 A

b) Calculating Reactive Power:

The reactive power can be calculated as:

Q = P tanα

where,

Q = Reactive power

P = Active Power

α = power factor angle

Since,

Cos\alpha =0.88\n\alpha =Cos^(-1)(0.88)\n\alpha=28.36

Therefore,

Q = 76.9 * tan (28.36)\nQ = 76.9 * (0.5397)\nQ = 41. 5 kVAr