#1. Input test A+B Problem

Input test A+B Problem

Problem: A + B

This is the example A + B problem, to help you get an idea of how to use the online judge system.

Task: Write a program that reads two integers from standard input and prints their sum to standard output.

Click Enter Online Programming Mode to open the built-in Hydro IDE.

🌟 Remember to choose the language you are using in the submission page.


Example Input

3 7

Example Output

10

Example Solutions

Python

# Read two integers from standard input
a, b = map(int, input().split())

# Print their sum
print(a + b)

C

#include <stdio.h>

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

Node.js (JavaScript)

// Read input from stdin
const fs = require('fs');
const input = fs.readFileSync(0, 'utf-8').trim().split(' ').map(Number);

const [a, b] = input;
console.log(a + b);

Rust

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();

    let nums: Vec<i32> = input
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();

    let sum = nums[0] + nums[1];
    println!("{}", sum);
}