Add Two Numbers

Accept two numbers and print their sum.

Example Input/Output 1:
Input:
10 20

Output:
30

Example Input/Output 2:
Input:
137 11

Output:
148

Python

X, Y = map(int, input().split())
print(X+Y)

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
System.out.print(X+Y);
}
}

C

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int X, Y;
    scanf("%d %d", &X, &Y);
    printf("%d", X+Y);
    return 0;
}

C++

#include <iostream> 
using namespace std;
int main() {
    int N;
    cin >> N;
    cout << N + 2;
    return 0;
}

Leave a Reply

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

More posts. You may also be interested in.