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
agasfer [191]
4 years ago
12

g Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in bin

ary. For an integer x, the algorithm is:
Engineering
1 answer:
Phoenix [80]4 years ago
4 0

Answer:

The solution is written in Python

  1. binary = ""
  2. decimal = 13
  3. quotient = int(decimal / 2)  
  4. remainder = decimal % 2
  5. binary = str(remainder) + binary
  6. while(quotient >0):
  7.    decimal = int(decimal / 2)
  8.    quotient = int(decimal / 2)  
  9.    remainder = decimal % 2
  10.    binary = str(remainder) + binary
  11. print(binary)

Explanation:

Firstly, we declare a variable <em>binary</em> and initialize it with an empty string (Line 1). This <em>binary </em>is to hold the binary string.

Next, we declare variable <em>decimal, quotient </em>and<em> remainder </em>(Line 2-4). We assign a test value 13 to decimal variable and then get the first quotient by dividing decimal with 2 (Line 3). Then we get the remainder by using modulus operator, % (Line 4). The first remainder will be the first digit joined with the binary string (Line 5).  

We need to repeat the process from Line 3-5 to get the following binary digits. Therefore create a while loop (Line 7) and set a condition that if quotient is bigger than 0 we keep dividing decimal by 2 and calculate the quotient and remainder and use the remainder as a binary digit and join it with binary string from the front (Line 9-11).

At last, we print the binary to terminal (Line 13).

You might be interested in
Stirrups are used in a concrete beam:_______
VMariaS [17]
The answer is E to increase the shear strength of the beam beyond that provided by the concrete
5 0
3 years ago
Can anyone answer this question
Solnce55 [7]

Answer:

a) 2.18 m/s^2

b) 9.83 m/s

Explanation:

The flywheel has a moment of inertia

J = m * k^2

Where

J: moment of inertia

k: radius of gyration

In this case:

J = 144 * 0.45^2 = 29.2 kg*m^2

The block is attached through a wire that is wrapped around the wheel. The weight of the block causes a torque.

T = p * r

r is the radius of the wheel.

T = m1 * g * r

T = 18 * 9.81 * 0.6 = 106 N*m

The torque will cause an acceleration on the flywheel:

T = J * γ

γ = T/J

γ = 106/29.2 = 3.63 rad/s^2

SInce the block is attached to the wheel the acceleration of the block is the same as the tangential acceleration at the eddge of the wheel:

at = γ * r

at = 3.63 * 0.6 = 2.81 m/s^2

Now that we know the acceleration of the block we can forget about the flywheel.

The equation for uniformly accelerated movement is:

X(t) = X0 + V0*t + 1/2*a*t^2

We can set a frame of reference that has X0 = 0, V0 = 0 and the X axis points in the direction the block will move. Then:

X(t) = 1/2*a*t^2

Rearranging

t^2 = 2*X(t)/a

t = \sqrt{\frac{2*X(t)}{a}}

t = \sqrt{\frac{2*18}{2.81}} = 3.6 s

It will reach the 1.8 m in 3.6 s.

Now we use the equation for speed under constant acceleration:

V(t) = V0 + a*t

V(3.6) = 2.81 * 3.6 = 9.83 m/s

7 0
4 years ago
Copper is generally considered easy to weld because of its high thermal conductivity: (a) true or (b) false?
inn [45]

Answer:

b)False

Explanation:

Those material have high thermal it is very difficult to weld because due to high thermal conductivity it transmit the heat in to the surrounding and can not reach a particular temperature required to melt the material.And when material does not melt then there is no possibility to weld the material.

So from above we can say that it is very difficult to weld the copper material due to high thermal conductivity.Generally welding of copper done by usiong gas welding technique.

So our option b is right.

8 0
3 years ago
An uncovered swimming pool loses 1.0 inch of water off its 1,000 ft^2 surface each week due to evaporation. The heat of vaporiza
soldi70 [24.7K]

Answer:

The affirmation is true, the cover will be worth buying

Explanation:

The equation necessary to use is

E = m*cv,

Where

cv: the heat of vaporization.  

Finding the rate at which the water evaporates (m^3/week).  

The swimming pool loses water at 1 inch/week off its 1,000 ft^2

Than,

1000 ft² * 1 in/wk * 1 ft/12 in = 83.33 ft³/week

To obtains the rate of mass loss it is necessary to multiply it for the density of water

83.33 ft³/week * 62.4 lb/ft³ = 5200 lb/week

Knowing the vaporization heat it is possible to find the rate of heat which is leaving the swimming pool  

5200 lb/week * 1050 BTU/lb = 5460000 btu/week

Over a 15-week period, the pool loses 81.9 million BTU.  

Knowing the cost of energy to heat the pool is $10.00 per million btu

The price = $819

This way, the affirmation is true, the cover will be worth buying

3 0
3 years ago
The ________ is considered the normal operating control of an air conditioner, according to the Standards of Practice. thermosta
mamaluj [8]

Answer:

Thermostat

Explanation:

The thermostat is considered the normal operating control of an air conditioner, according to the Standards of Practice.

8 0
2 years ago
Other questions:
  • Here you will program the Newton-Raphson root finding method with details specified as fol-lows. Your code will continue perform
    5·1 answer
  • What are the functions of a gear
    8·2 answers
  • The small washer is sliding down the cord OA. When it is at the midpoint, its speed is 28 m/s and its acceleration is 7 m/s 2 .
    13·1 answer
  • A freshwater jet boat takes in water through side vents and ejects it through a nozzle of diameter D = 75 mm; the jet speed is V
    5·1 answer
  • Determine the minimum radius of a horizontal circular curve for a route having a 70 mph design speed, super-elevation (e) 3%, an
    8·1 answer
  • Early mountaineers boiled water to estimate their altitude. If they reached the top and found that water boiled at 89°C, approxi
    14·1 answer
  • (a) Design a low-pass filter with a cutoff frequency of 12 kHz. Use0.15 uF capacitor and an appropriate resistor. B) Sketch and
    15·1 answer
  • A stream of moist air flows into an air conditioner with an initial humidity ratio of 0.6 kg(vapor)/kg(dry air), and a dry air f
    7·1 answer
  • When lining up the song on the tempo grid it is important to allow
    13·1 answer
  • Which term refers to the use of a resource that does not cause permanent damage to the environment?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!