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]
3 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]3 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
What did the ancient Greeks use simple machines for?
nalin [4]
Native Americans who used spears to hunt were using wedges. In the third century BC, the Greek scientist Archimedes invented a way to lift water, called the Archimedes screw. It was used to water crops and to move water out of ships.
6 0
3 years ago
Read 2 more answers
NEED HELP PLEASE
alexira [117]

Explanation:

i believe c dye to u having a right to Express your concern if you feel to

4 0
3 years ago
For laminar flow over a hot flat plate, the local heat transfer coefficient decreases with distance because (select all that are
kotegsom [21]

Answer:

B. The thickness of the heated region near the plate is increasing.

Explanation:

First we know that, a boundary layer is the layer of fluid in the immediate vicinity of a bounding surface where the effects of viscosity are significant. The fluid is often slower due to the effects of viscosity. Advection i.e the transfer of heat by the flow of liquid becomes less since the flow is slower, thereby the local heat transfer coefficient decreases.

From law of conduction, we observe that heat transfer rate will decrease based on a smaller rate of temperature, the thickness therefore increases while the local heat transfer coefficient decreases with distance.

3 0
4 years ago
Refrigerant-134a is to be cooled by water in a condenser. The refrigerant enters
KonstantinChe [14]

Answer:

Refrigerant R-134a is to be cooled by waterin a condenser.The refrigerant enters thecondenser with a mass flow rate of 6 kg/minat 1 MPa and 70 C and exits at 35 C. The cool-ing water enters at 300 kPa and 15 C andleaves at 25 C. Neglecting pressure drops,determine a) the required mass flow rate ofthe cooling water, and b) the heat transferrate from the refrigerant to the water.SolutionFirst consider the condenser as the control volume. The process is steady,adiabatic and no work is done. Thus over any time intervalΔt,ΔEΔt=0and thusXin˙E=Xout˙Ewhere˙E=˙m h+12V2+gz650:351 Thermodynamics·Prof. Doyle Knight37

Background image

I only know this

sorry for errors

4 0
3 years ago
What are some common work contexts for Licensing Examiners and Inspectors? Select four options.
Akimi4 [234]

According to O*NET, the common work contexts for Licensing Examiners and Inspectors include:

  1. Telephone
  2. Face-to-face discussions
  3. Contact with others
  4. Importance of being exact or accurate.

O*NET is an acronym for occupational information network and it refers to a free resource center or online database that is updated from time to time with several occupational definitions, so as to help the following categories of people understand the current work situation in the United States of America:

  • Workforce development professionals
  • Students
  • Human resource (HR) managers
  • Job seekers
  • Business firms

On O*NET, work contexts are typically used to describe the physical and social elements that are common to a particular profession or occupational work. Also, the less common work contexts are listed toward the bottom while common work contexts are listed toward the top.

According to O*NET, the common work contexts for Licensing Examiners and Inspectors include:

1. Telephone

2. Face-to-face discussions

3. Contact with others

4. Importance of being exact or accurate.

Read more on work contexts here: brainly.com/question/22826220

6 0
3 years ago
Read 2 more answers
Other questions:
  • A heating cable is embedded in a concrete slab for snow melting. The heating cable is heated electrically with joule heating to
    9·1 answer
  • A 15. μF capacitor is connected to a 50. V battery and becomes fully charged. The battery is removed and a slab of dielectric th
    10·1 answer
  • Question 44
    8·1 answer
  • Hydrogen gas (density = 1.165 kg/m^3 ) is stored at 25°C in a permeable cylindrical container which has an outer diameter of 0.2
    11·1 answer
  • Is a steam power plant a heat engine?
    14·1 answer
  • while performing a running compression test how should running compression compare to static compression
    5·1 answer
  • Consider a single crystal of some hypothetical metal that has an FCC crystal structure and is oriented such that a tensile stres
    12·1 answer
  • When _____ ,the lithium ions are removed from the_____ and added into the _____
    8·1 answer
  • What color is an orange? its for my 8th grade
    13·1 answer
  • Please help me please
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!