Add Two Numbers Codechef Solution

Hello coders, today we are going to solve Add Two Numbers Codechef Solution. Which is a part of Codechef Solution.

Add Two Numbers Codechef Solution
Add Two Numbers Codechef Solution


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.


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.


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


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



1 2
100 200
10 40



Add Two Numbers CodeChef Solution in Python

N = int(input())
while N > 0:
    x, y = map(int, input().split())
    sum = x + y
    N = N - 1

Add Two Numbers CodeChef Solution in CPP

#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);
    return 0;

Add Two Numbers CodeChef Solution in JAVA

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(;
		int T = sc.nextInt();
		for (int tc = 0; tc < T; tc++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(solve(A, B));
	static int solve(int A, int B) {
		return A + B;

Disclaimer: The above Problem (Add Two Numbers) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.

Sharing Is Caring

Leave a Comment