“dezimaler zu binärer GFG” Code-Antworten

Dezimal zu binär

# 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)
dwiki pradana

dezimaler zu binärer GFG

# Function to convert decimal to binary
# using built-in python function
def decimalToBinary(n):
    # converting decimal to binary
    # and removing the prefix(0b)
    return bin(n).replace("0b", "")
   
# Driver code
if __name__ == '__main__':
    # calling function
    # with decimal argument
    print(decimalToBinary(77))
codelearner

Ähnliche Antworten wie “dezimaler zu binärer GFG”

Fragen ähnlich wie “dezimaler zu binärer GFG”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen