Add Two Numbers Codechef Solution

Hello Programmers In this post, you will know how to solve the Add Two Numbers Codechef Solution.

Add Two Numbers Codechef Solution
Add Two Numbers Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.


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 Solutions in Python

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

Add Two Numbers CodeChef Solutions 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 Solutions 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 BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: ATM Codechef Solution

Leave a Reply

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