BOJ 2558 A+B - 2

1 개요[ | ]

BOJ 2558 A+B - 2
  • 두 수의 입력을 받아 더한 값을 출력하는 문제

2 Bash[ | ]

read a
read b
expr $a + $b

3 C[ | ]

#include <stdio.h>
int main() {
	int a, b;
	scanf("%d",&a);
	scanf("%d",&b);
	printf("%d\n",a+b);
	return 0;
}

4 C++[ | ]

#include <iostream>
using namespace std;
int main() {
    auto a=0, b=0;
    cin >> a >> b;
    cout << a+b << endl;
    return 0;
}

5 C#[ | ]

using System;
public class Program {
    public static void Main() {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        Console.WriteLine(a+b);
    }
}

6 Java[ | ]

import java.util.*;
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 );
    }
}

7 node.js[ | ]

var fs = require('fs');
var input = fs.readFileSync('/dev/stdin').toString().split('\n');
var a = parseInt(input[0]);
var b = parseInt(input[1]);
console.log(a+b);

8 Perl[ | ]

print <>+<>
print <> + <> . "\n";

9 PHP[ | ]

<?php
fscanf(STDIN,"%d",$a);
fscanf(STDIN,"%d",$b);
fprintf(STDOUT,"%d",$a+$b);

10 Python[ | ]

a = int(input())
b = int(input())
print( a+b )

11 R[ | ]

x<-scan("stdin")
cat(x[1]+x[2])
x <- scan("stdin")
a <- x[1]
b <- x[2]
cat( a+b )
fp=file("stdin", "r")
a=scan(file=fp, what=integer(0), n=1)
b=scan(file=fp, what=integer(0), n=1)
cat(a+b)

12 Ruby[ | ]

a = gets.to_i
b = gets.to_i
puts a + b

13 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}