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]
2 years ago
13

Lab 6B: printing a binary number

Computers and Technology
1 answer:
r-ruslan [8.4K]2 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
etwork behavior analysis system __________ sensors are typically intended for network perimeter use, so they are deployed in clo
jeka94

Answer:

"Inline" is the correct answer.

Explanation:

  • Network behavior analysis (NBA)  or Analysis of network activity seems to be the technique to observe traffic trends that aren't groups or sets throughout the cable network's everyday traffic.
  • Simplest terms, this is the organization's effort to define network anomalies outside pure congested traffic expect a seamless.

So that the above is the correct answer.

6 0
3 years ago
PLEASE HELP THIS WAS DUE YESTERDAY AND I DIDN'T GET TO IT IN TIME!!!!!!
kykrilka [37]

Answer:

dDAgv

Explanation:

sdc sdc sdc trust me

7 0
3 years ago
Cui documents must be reviewed to which procedures before destruction?
Aliun [14]

Answer:

Documents containing CUI must be destroyed by shredding..

Explanation:

Hope it helps you..

Your welcome in advance..

(ㆁωㆁ)

8 0
2 years ago
How can photography allow us to view the world around us in different ways?
Ymorist [56]
It captures a single moment that one might not see with a naked eye. It shows the beauty and the essence of simple things in one exact moment. And it allows the viewer to take more time to reflect on what is captured and really find meaning within it.
6 0
3 years ago
Read 2 more answers
Where would you go to add fractions to a document in adobe indesign
prisoha [69]

Just select the fraction text and choose Open Type > Fractions from the Character panel menu.

5 0
3 years ago
Other questions:
  • Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output param
    11·1 answer
  • An important piece of a project is past due date.
    9·2 answers
  • What does limited access to a document mean?
    14·2 answers
  • The lightbulb transfers electricity energy into light what is one type of energy that is also generated that is not a desired af
    14·1 answer
  • Which element in the PowerPoint application is not available in the Microsoft Word application?
    12·2 answers
  • Determine whether the phrase below is a sentence or a fragment.
    12·1 answer
  • A ____ is a a set of presentation rules that control how text should look. It is applied to an XML file to change the collection
    9·1 answer
  • What method of thermal energy is at work when heat lamps are used to warm up baby chickens?
    11·2 answers
  • Kai notices his laptop is running sluggishly, so he wants to check his system resources for any issues. Which utility can he use
    11·2 answers
  • How do we produce quality work in editing audio?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!