Question

To convert decimal number enetered by the user into its equivalent Binary number. 

27 Apr 2023
Answer :
Word Count : 277

To convert a decimal number to its binary equivalent, you can use the following algorithm:

  1. Take the decimal number as input from the user.
  2. Divide the decimal number by 2, and note down the quotient and the remainder.
  3. Divide the quotient obtained in step 2 by 2, and again note down the quotient and remainder.
  4. Continue this process until the quotient becomes zero.
  5. The binary equivalent of the decimal number is obtained by arranging the remainders obtained in reverse order.

Here's a Python code example that implements this algorithm:


decimal_num = int(input("Enter a decimal number: "))

# initialize an empty list

__________ _________ _____ ____ _______.
___ _________ _________ _________ ___ ______ _________ __________ _______ ________ ______ ___.
_____ ___ ____ _______ ______ _______ _______ _________.
___ ________ ______ ________ ______ ________ __________ ________.
______ ___ _________ ____ __________ __________ ___ ___ ___ _________ _________ ________.
__________ ____ _________ _________ ______ _______.
___ ___ _____ ____ _________.
______ ______ _____ ______ _____ ________.
________ ___ _________ ___ _____ _______ _________ _________ ______.
_________ _____ ___ ________ _______ ___ _____ _______ ______ ___ ______.
_____ _______ ____ ___ ___ _______.
_________ ____ _____ ____ ______ ________ ____.
____ ________ ___ __________ _____.
_________ ________ ______ ________ __________ ______.
__________ __________ _______ ___ ________ ____ _______ _________ __________ ________ ___.
__________ _________ ________ ___ _________ _________ ___ ____ ______.
________ _________ __________ ____ _______ ____ ________ ________ ____ ________ ______ __________.
_________ ______ ____ ____ ________ ___ _______ __________ _______ _____ _______.
____ __________ _______ _________ ________.
____ ________ __________ ___ _____ _______ ____.
_________ _______ _______ __________ ___ ____.
_____ _____ ________ ______ _______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 205 2022 2023 - To convert decimal number enetered by the user into its equivalent Bin | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→