Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
#2: Post edited by (deleted user) · 2021-07-10T17:23:08Z (over 3 years ago)
  • I am giving Python code.
  • ```python
  • # Function to convert decimal number
  • # to binary using recursion
  • def DecimalToBinary(num):
  • if num >= 1:
  • DecimalToBinary(num // 2)
  • print(num % 2, end = '')
  • # Driver Code
  • if __name__ == '__main__':
  • # decimal value
  • dec_val = 24
  • # Calling function
  • DecimalToBinary(dec_val)
  • ```
  • ![conversion](https://math.codidact.com/uploads/YJ1fiAVd3iaxK7ZfHN5CXxGS)
  • I hope it is understandable. Keep diving until you get zero. And, note every remainders. Remainders is binary.
  • I am giving Python code.
  • ```python
  • # Function to convert decimal number
  • # to binary using recursion
  • def DecimalToBinary(num):
  • if num >= 1:
  • DecimalToBinary(num // 2)
  • print(num % 2, end = '')
  • # Driver Code
  • if __name__ == '__main__':
  • # decimal value
  • dec_val = 24
  • # Calling function
  • DecimalToBinary(dec_val)
  • ```
  • ![conversion](https://math.codidact.com/uploads/YJ1fiAVd3iaxK7ZfHN5CXxGS)
  • I hope it is understandable. Keep diving until you get zero. And, note every remainders. Remainders is binary.
  • Note : sometime some computers use 0 before binary. E.g. binary of 85 is 1010101 but, some computer will write 01010101.
  • I think it happens for encoding. Any computer can decode both and, return same value.
#1: Initial revision by (deleted user) · 2021-07-10T16:28:11Z (over 3 years ago)
I am giving Python code.

```python
# Function to convert decimal number
# to binary using recursion
def DecimalToBinary(num):
     
    if num >= 1:
        DecimalToBinary(num // 2)
    print(num % 2, end = '')
 
# Driver Code
if __name__ == '__main__':
     
    # decimal value
    dec_val = 24
     
    # Calling function
    DecimalToBinary(dec_val)
```


![conversion](https://math.codidact.com/uploads/YJ1fiAVd3iaxK7ZfHN5CXxGS)

I hope it is understandable. Keep diving until you get zero. And, note every remainders. Remainders is binary.