-->
当前位置:首页 > 题库

PROGRAMMING:Binary addition of integers

Luz5年前 (2021-05-10)题库538
Enter two integers with the size between '[0,63]'. Find their binary sum, which is represented by 8 bits.
###Input format:
Enter an integer on one line and another on the other.
###Output format:
Output their binary sum.
###Input example:
Here is a set of inputs. For example:
```in
five
seven
```
###Output example:
The corresponding output is given here. For example:
```out
00000101
00000111
--------
00001100
```







answer:If there is no answer, please comment
```
a=int(input())
b=int(input())
print("{:>08s}".format(bin(a)[2:]))
print("{:>08s}".format(bin(b)[2:]))
print("--------")
print("{:>08s}".format(bin(a+b)[2:]))
```