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
vivado [14]
3 years ago
12

Write a program that asks the user to enter a positive integer that represents a number in the decimal system and then displays

the binary representation of the number. Your solution must include at least the following function: decimalToBinary(number): a recursive function that takes a positive integer number (in decimal) as its parameter and returns a string with it's binary representation. g
Computers and Technology
1 answer:
Maru [420]3 years ago
3 0

Answer:

In Python:

def decimalToBinary(num):

   if num == 0:

       return 0

   else:

       return(num%2 + 10*decimalToBinary(int(num//2)))

       

decimal_number = int(input("Decimal Number: "))

print("Decimal: "+str(decimalToBinary(decimal_number)))

Explanation:

This defines the function

def decimalToBinary(num):

If num is 0, this returns 0

<em>    if num == 0: </em>

<em>        return 0 </em>

If otherwise

   else:

num is divided by 2, the remainder is saved and the result is recursively passed to the function; this is done until the binary representation is gotten

       return(num%2 + 10*decimalToBinary(int(num//2)))

       

The main begins here.

This prompts the user for decimal number

decimal_number = int(input("Decimal Number: "))

This calls the function and prints the binary representation

print("Decimal: "+str(decimalToBinary(decimal_number)))

You might be interested in
Which statement best describes the purpose of SmartArt graphics in PowerPoint presentations?
Alchen [17]

Answer:

They are an easy mechanism for combining text and graphics.

Explanation:

7 0
3 years ago
Read 2 more answers
Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. Please select the
harina [27]

A web resume is far better than a traditional resume because it can carry so much data about the person, and it includes images also. This statement is true.

<h3>What is a web resume?</h3>

A web resume is termed as a resume that is read by a computer program that summarizes the information of each employee.

Web resume has the data such as their parent name, education, skills, job experience, hobbies, languages, and so on.

Thus, the photo of the document about the project or internship that has been done in the past can be given on the web resume by uploading the certificate on the computer system along with the resume.

For example, in companies like Linkedin, apna, and so on there are many companies that ask about the person before creating an account.

More about the web resume link is given below.

brainly.com/question/862477

7 0
2 years ago
7+9 help me pleas i dont know help now
natali 33 [55]

Answer:

16

Explanation:

because it is

4 0
2 years ago
Read 2 more answers
Which Cisco IOS command will permit the engineer to modify the current configuration of the switch while it is powered on?
DIA [1.3K]
Configure terminal because Commands in this mode are written to the running configuration file as soon as you enter them (using the Enter key/Carriage Return). After you enter the configure terminal command, the system prompt changes from switch# to switch(config)#, indicating that the switch is in configuration mode.
7 0
3 years ago
Is a collection of information stored under a single name ​
oksian1 [2.3K]

\boxed{ File  } is a collection of information stored under a single name.

\bold{ \green{ \star{ \orange{Mystique35}}}}⋆

3 0
3 years ago
Read 2 more answers
Other questions:
  • When performing actions between your computer and one that is infected with a virus which of the following offers no risk becomi
    5·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    14·1 answer
  • When you set the position property for a block element to absolute, the browser?
    8·1 answer
  • Does the game best fiend need wifi to play on the app?
    8·2 answers
  • Which tag defines the visible content of a web document?
    10·1 answer
  • How to count how many uppercase letters in sentence in python?
    8·1 answer
  • WILL UPVOTE ALL
    10·1 answer
  • PLEASE HELP ME WITH THIS QUESTION:
    8·1 answer
  • ____ is an easy way to invitation through a web page​
    13·1 answer
  • You are working with a database table that contains data about music. The table includes columns for track_id, track_name (name
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!