Add Two Numbers

Lab Java Beginner 10 points

Read two integers and print their sum.

Input

Two integers (spaces or new lines between them).

Output

Their sum.

Example

Input

3 4

Output

7
Sample input available Sample output available
Editor
Java

Hints

Create a Scanner on System.in.

nextInt() reads the next whole number, skipping spaces and new lines.

Solution explanation

Scanner splits input into tokens, so it doesn't matter whether numbers are on one line or several.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a + b);
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD