Write a python function to convert a number from decimal to binary


Topic: Write a python function to convert a number from decimal to binary

Solution

 
 def decToBinary(n): 
    binaryNum = [0] * n;  
    i = 0; 
    while (n > 0):   
        binaryNum[i] = n % 2; 
        n = int(n / 2); 
        i += 1; 
    for j in range(i - 1, -1, -1): 
        print(binaryNum[j], end = ""); 
 



List all Python Programs