The code given below is to convert decimal to the binary number system .
for b in range(0,100): x=int(input("\nEnter Decimal number : ")) z=x a=1 sun=0 while x!=0: rem=x%2 sun=sun+rem*a a=a*10 x=x//2 print("Decimal number = ",z,"\n") print("Binary number= ",sun)
First for loop for the taking input from the user for many times. And the actual logic is working inside while loop.
1. Firstly calculate the remainder of the given number.
2.secondly convert the number into digits.
3.thirdly updating the values of a and x and loop will run until the condition is true.
Now you need to take a pen and paper and try to solve each line by line by yourself and you will understand.