C: Add two numbers

Read two whole numbers a and b and print their sum.

What to build

A program that reads two numbers and adds them safely.

Requirements

  • Read the two numbers.
  • Print their sum.

Input

One line with two whole numbers between -2000000000 and 2000000000.

Output

One line: a + b.

Constraints

Each number is between -2000000000 and 2000000000, so the sum may not fit in an int.

Example

Input:

3 4

Output:

7

Why it works

Using long long makes room for a sum of up to four billion, which an int cannot hold.

Examples

Example 1 · Input
3 4
Expected output
7
Example 2 · Input
-10 25
Expected output
15

Hints

Hint 1

Read with scanf("%d %d", &a, &b); the & matters.

Hint 2

The numbers fit in an int, but their sum may not: use long long for the sum and print it with %lld.

Solution

Show one correct solution (try it yourself first)
#include <stdio.h>

int main(void) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    printf("%lld\n", a + b);
    return 0;
}

Lesson: Input and output: printf and scanf →