InterviewSolution
Saved Bookmarks
| 1. |
Write a Program to add two integers >0 without using the plus operator. |
|
Answer» We can use bitwise OPERATORS to ACHIEVE this. def add_nums(num1, num2): while num2 != 0: data = num1 & num2 num1 = num1 ^ num2 num2 = data << 1 return num1print(add_nums(2, 10)) |
|