Faulty Key Problem Statement
Ninja needs to create a function to calculate the sum of two integers without using the “+” operator due to keyboard issues. Help Ninja find the sum of two numbers without using the "+" operator anywhere in your code.
Note:
You should also not use the increment "++" operator either.
Input:
The first line contains an integer ‘T’ denoting the number of test cases. Each test case consists of one line with two space-separated integers, A and B.
Output:
For each test case, output the sum of A and B without using the "+" operator on a new line for each test case.
Example:
You are given A = 4, B = 6, their sum should be output as 10.
Constraints:
- 1 <= T <= 100
- -10000 <= A, B <= 10000
Where ‘T’ is the number of test cases, and ‘A’ and ‘B’ are the integers.

AnswerBot
4mo
Calculate the sum of two integers without using the '+' operator or the '++' operator.
Use bitwise XOR to add the two numbers without carrying.
Use bitwise AND and left shift to handle the carry.
Repeat ...read more
Help your peers!
Add answer anonymously...
>
INCA INFOTECH TECHNOLOGIES Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

