Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Add Two Numbers CodeChef Solution

Problem – Add Two Numbers CodeChef Solution

Problem Statement

Every problem starts with a Problem Statement. It tells you in detail about the task to be solved.

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.

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

Input Format

This section tells you the format in which your program should receive the input.

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

This section tells us the format in which your program should give the output

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

Everything your program prints is considered “output”, so if you output some debugging statements like “Please enter T”, this will be considered as part of your answer, and because it does not satisfy the output format, it will be marked wrong, even if your answer is otherwise correct!


This section tells you the maximum and minimum possible values the variables in the problem statement can take. You do not need to check these constraints in your program. You can safely assume that the input given to your program will be in the given range of constraints.

  •  T  1000
  •  A,B  10000

Sample 1:

1 2
100 200
10 40


Add Two Numbers CodeChef Solution in Python3

#Read the number of test cases.
T = int(input())
for tc in range(T):
	# Read integers a and b.
	(a, b) = map(int, input().split(' '))
	ans = a + b

Add Two Numbers CodeChef Solution in C++17

#include <iostream>
using namespace std;
int main() 
   int n;
   int a,b;
    int sum=0;
   return 0;

Add Two Numbers CodeChef Solution in Java

import java.util.StringTokenizer;

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

		InputReader in = new InputReader(inputStream);

		// 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;

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;

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

		public int nextInt() {
			return Integer.parseInt(next());
Add Two Numbers CodeChef Solution Review:

In our experience, we suggest you solve this Add Two Numbers CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Add Two Numbers CodeChef Solution

Find on CodeChef


I hope this Add Two Numbers CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *