Editorial for Sum two numbers

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.
by: martin

Java Solution

• Just the solution
Scanner scanner = new Scanner(System.in);
int num1 = scanner.nextInt();
int num2 = scanner.nextInt();

System.out.println(num1 + num2);


JavaScript Solution

• Just the solution
// Solution of the problem.
const a = Number(gets());
const b = Number(gets());

print(a + b);

• The solution with local testing
const getGets = (arr) => {
let index = 0;

return () => {
const toReturn = arr[index];
index += 1;
};
};

// This is the place where you must place your test data
const test = [
'2', // This is the first line from the test.
'2' // This is the second line from the test.
];

const gets = this.gets || getGets(test);
const print = this.print || console.log;

// Solution of the problem. All the above code is for local testing. The test variable is with the first test case 2 + 2 = 4
const a = Number(gets());
const b = Number(gets());

print(a + b);