# Add Two Numbers | CodeChef Solution

Today we will be solving Add Two Numbers CodeChef problem in C++ and Python. So, without further ado let’s jump to the problem.

Shivam is the youngest programmer in the world, he is just 12 years old. Shivam is learning programming and today he is writing his first program.

Program is very simple, Given two integers A and B, write a program to add these two numbers.

## Input

The first line contains an integer T, the total number of text cases. Then follow T lines, each line contains two integers A and B.

## Output

For each test case, add A and B and display it in a new line.

## Constraints

1 â‰¤ T â‰¤ 1000

0 â‰¤ A,B â‰¤ 10000

## Example

### Input

``````3
1 2
100 200
10 40``````

### Output

``````3
300
50``````

## Solution – Add Two Numbers CodeChef Solution

### Python

```#Note that it's python3 Code. Here, we are using input() instead of raw_input().
#You can check on your local machine the version of python by typing "python --version" in the terminal.

#Read the number of test cases.
N = int(input())
while N > 0:
x, y = map(int, input().split())
sum = x + y
print(sum)
N = N - 1```

### C++

```// bits/stdc++.h
// It loads most of the libraries of C++ required.
#include <bits/stdc++.h>

using namespace std;

int main() {
// Read the number of test cases.
int T;
scanf("%d", &T);
int i=0;
while (i<T) {
// Read the input a, b
int a, b;
scanf("%d %d", &a, &b);

// Compute the ans.
int ans = a + b;
printf("%d\n", ans);

i++;
}

return 0;
}
ï»¿```

Disclaimer: The above problem (Add Two Numbers) is generated by CodeChef but the solution is provided by CodingBroz.

Broz Who Code

CodingBroz