“desimal ke gfg biner” Kode Jawaban

Desimal ke biner

# 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

desimal ke gfg biner

# 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

Jawaban yang mirip dengan “desimal ke gfg biner”

Pertanyaan yang mirip dengan “desimal ke gfg biner”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya