Q2)Sum of Two Numbers

Q2)Sum of Two Numbers

You are given two numbers a and b. Your task is to find the sum of two numbers.
Input
The first line contains an integer t, denoting the number of test cases. Next t lines contain two integers, a and b separated by a space.
Input Constraint
1 <= t <= 1000000000
1 <= a, b <= 1000000000
Output
For every number a and b, output the sum of two numbers a and b.


Sample Input                Sample Output

1
1 2 3
Answer
---------------------------------------------------------------------------------
import java.math.BigInteger; 
import java.io.BufferedReader;
import java.io.InputStreamReader;
class TestClass {
    public static void main(String args[] ) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int N = Integer.parseInt(line);
        for (int i = 0; i < N; i++) {
        line=br.readLine();
        String str[]=new String[line.length()];
    str=line.split(" ");
      BigInteger a=new BigInteger(str[0]);
   BigInteger b=new BigInteger(str[1]);
   BigInteger c=new BigInteger("0");
   c=b.add(a);
   System.out.println(c);
        }
    }
}

Comments