# CodeChef - Add Two Numbers

Add Two Numbers problem from CodeChef.

Problem Statement

The task is very simple: given two integers A and B, write a program to add these two numbers and output it.

Input Format

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

Output Format

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

Constraints

• 1 <= T <= 1000
• 1 <= A, B <= 10000

Solution in Java:

``````import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.InputStream;

// Remember that the class name should be "Main" and should be "public".
public class Main {
public static void main(String[] args) {
// System.in and System.out are input and output streams, respectively.
InputStream inputStream = System.in;

// Read the number of test casese.
int T = in.nextInt();
while (T-- > 0) {
// Read the numbers a and b.
int a = in.nextInt();
int b = in.nextInt();

// Compute the sum of a and b.
int ans = a + b;
System.out.println(ans);
}
}

public StringTokenizer tokenizer;

tokenizer = null;
}

public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
} catch (IOException e) {
throw new RuntimeException(e);
}
}