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
kaheart [24]
3 years ago
13

Lab 6B: printing a binary number

Computers and Technology
1 answer:
r-ruslan [8.4K]3 years ago
7 0

Answer:

In Python:

num = int(input("Enter a decimal integer: "))

temp = num

bin = ""

while num > 0:

   bin = str(num%2)+bin

   num//=2

print(str(temp)+" in binary is "+str(bin))

Explanation:

This prompts the user for a decimal number

num = int(input("Enter a decimal integer: "))

This assigns the input number to a temporary variable

temp = num

This initializes the binary output to an empty string

bin = ""

This loop is repeated while num is greater than 0

while num > 0:

This appends the remainder of num divided by 2 to the front of the binary variable bin

   bin = str(num%2)+bin

This calculates the floor division of num and 2

   num//=2

This prints the required output

print(str(temp)+" in binary is "+str(bin))

You might be interested in
Que problema se puede usar con el uso de las TIC ?​
raketka [301]
We do not speak English in this please translate in Google because we do not know Spanish
8 0
3 years ago
2. Name the layer of the Web/Internet Protocol Stack with which each of these functions is associated.
Nadya [2.5K]

Answer:

a. Encrypt a message - Application layer

b. Prevent buffer overruns - Transport Layer

c. Choose the best route for a data packet - Network Layer

d. Compose an email message - Application layer

Explanation:

3 0
3 years ago
Read 2 more answers
Name 3 coding languages
Pavlova-9 [17]

Answer:

javascript, python, c#

Explanation:

7 0
3 years ago
Read 2 more answers
How would you define the term technology
ivanzaharov [21]
Technology is a way that most people are communicating now a days, whether it be with a phone, computer, etc. It’s is also how businesses can do things like making ad’s.

Not great at explaining things but you can probably make it sound a lot better by adding in your own word!
5 0
3 years ago
Suppose that a machine with a 5-stage pipeline uses branch prediction. 15% of the instructions for a given test program are bran
zhenek [66]

Answer:

solution attached below

Explanation:

3 0
3 years ago
Other questions:
  • The __________ is the continuity of control of evidence that makes it possible to account for all that has happened to evidence
    14·2 answers
  • What are examples of people who own the copyrights of their property? Check all that apply.
    10·2 answers
  • The picture that graphically represents the items you use in Windows is called a/an
    15·1 answer
  • What is the size of the program counter for an avr that has a 1 kbyte rom capacity?
    9·1 answer
  • What is the name of the interface that uses graphics as compared to a command-driven interface?
    11·1 answer
  • Which of the following could be true of two diffrent speicies that have competitieve realtionship in the same ecosytem?
    10·1 answer
  • Data owners ensure that only the access that is needed to perform day-to-day operations is granted and that duties are separated
    10·1 answer
  • Input a number and find the square root only if the number entered is greater than or equal to zero.
    6·1 answer
  • Select all the correct answers.
    8·1 answer
  • When you hear music, read a printout, or view a video, you are using a computer's
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!