-It is a number which expressed in the base-2 numeral system,
-Binary numbers are 0 or 1.
Addition of two binary number -
b1=1010 // 10 in decimal
b2=101 // 5 in decimal
then sum of b1 and b2 is 1111 // 15 in decimal
print("Enter first binary number")
print("Enter second binary number")
print("Addition of two binary number is - "+s)
Enter first binary number
Enter second binary number
Addition of two binary number is - 0b10101
-In this program, firstly we take two input,
- int(n,2) derive the decimal equivalent so we find the decimal of both the number then add
- then using the bin() function we convert the decimal number into binary again. and this is the required ans.