"The sum of two integers" in different languages

LanguageSolutionLanguageSolution
C
#include <stdio.h>
int main(void) {
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d\n", a + b);
	return 0;
}
C++
#include <iostream>
using namespace std;
int  main() {
	int a, b;
	cin >> a >> b;
	cout << a + b;
	return 0;
}
Free Pascal
var a, b: longint;
begin
	readln(a, b);
	writeln(a + b);
end.
Kylix
var a, b: longint;
begin
	readln(a, b);
	writeln(a + b);
end.
Perl
$_=<>;
/(-?\d+)\s+(-?\d+)/;
print $1+$2;
Python
from string import split
a,b=map(int,split(raw_input()))
print a+b
Java
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
    Scanner s = new Scanner(System.in);
    System.out.println(s.nextInt() + s.nextInt());
  }
}
Ruby
class Array
  def sum
    s = 0;
    for i in 0..size-1
      s+=self[i].to_i
    end
    return s
  end
end

puts gets.split(/\s+/).sum
Scheme
(display (+ (read) (read)))
(newline)
  

© acm.mipt DevGroup
The page was generated in 170ms

SW soft NIX
ID = 54.156.67.164