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
What does flexibility look like within your learning? Relevancy of Flexibility: Why is this important to your students?
Yakvenalex [24]

Answer:

just look like I they legs and hope they don't pop off

7 0
3 years ago
How can I create an app ? What should I download from the App Store ? How can I put my app in the App Store ? PLEASE GIVE ME THE
crimeas [40]
It's not easy to create an app for cellphones it is harder than to create those for computers. You would need to learn swift coding language to create an application. 
6 0
3 years ago
Read 2 more answers
1) What are the six (6) core elements of developing a whole person? Explain
VashaNatasha [74]

Answer:

Here

Explanation:

Hope that was helpful!

4 0
3 years ago
You are the network administrator for Corpnet.com. You install the Windows Server Backup Feature on a Windows Server 2012 R2 fil
Vsevolod [243]

To ensure that multiple backups of the server are available for restores you should Modify the frequency of the scheduled backup.

a. Modify the frequency of the scheduled backup.

<u>Explanation:</u>

To backup system normal and good practices schedule every day either different folder, which is further classified day of a week name. For example Sunday, Monday, Tuesday Wednesday, Thursday, Friday Saturday backup schedule will once a week.

Suppose Monday backup schedule run once a week at midnight of every Monday, same away Tuesday backup schedule run once a week at midnight of every Tuesday. If we schedule weekly one day folder end user will have 6 last days folder so that end user can restore the data any point of time.

7 0
3 years ago
Checking authentication, checking authorization and access control, auditing systems, and verifying firewalls and other filters
nadezda [96]

Answer: Logical security list

Explanation:Logical security list that is used for checking of the authentication and authorization for the organizations. It consist the safeguarding the software, security access of password and other keys, system auditing, stages of the security etc.

These factors helps in the maintaining the level of the security and only authorized access to place in the system of a particular organization.Other options are incorrect because physical security system consist of the guards , locks etc physical devices, response plane is the feedback strategy and whiltelist is related with the acceptable people.

3 0
3 years ago
Other questions:
  • Which of these monitor connector types is the oldest and least desirable to use?
    12·2 answers
  • Please draw a diagram of a complete graph with 5 vertices (K5), its adjacency matrix and adjacency list representations.
    5·1 answer
  • What are comments meant to do?
    12·1 answer
  • Communication is defined as__________.
    10·1 answer
  • Match the term to its correct defintion
    6·1 answer
  • Create a Produceclass that hasan instance variable of type Stringfor the name, appropriate constructors, appropriate accessor an
    13·1 answer
  • Google Glass, glasses that allow you to take pictures and search online by speaking commands, are introduced at a technology tra
    8·1 answer
  • List the steps to look it install and then run a program or mobile app
    8·1 answer
  • What type of natural disaster stuck haiti in 2010 and killed more than 200,000 people
    9·2 answers
  • Which of the following could be part of an algorithm?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!