1288 - A+B Problem with sample answers
Calculate a+b
Input
Two integer a,b (0<=a,b<=10)
Output
Output a+b
Examples
Input
1 2
Output
3
Hint
#include <stdio.h>
int main()
{
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
}
program p1001(Input,Output);
var
a,b:Integer;
begin
while not eof(Input) do
begin
Readln(a,b);
Writeln(a+b);
end;
end.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int a = in.nextInt();
int b = in.nextInt();
System.out.println(a + b);
}
}
}
a=gets.chomp
b="0"
a.eachline(" "){
|d|
b=b+"+"+d
}
puts eval(b)
read a b
echo ((a+$b))
import sys
for line in sys.stdin:
a = line.split()
print int(a[0]) + int(a[1])
<?php
while (fscanf(STDIN, "%d%d", a, b) == 2) {
print (a + b) . "\n";
}
?>
#! /usr/bin/perl -w
while(<>){
chomp;
(a,b)=split(/\s/,$);
printf "%d\n",a+b;
}
using System;
public class Sum
{
public static void Main()
{
//string token = Console.ReadLine();
//int test = int.Parse(token);
for(int k = 0; k < 1;k++){
string[] tokens = Console.ReadLine().Split(' ');
Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1]));
}
}
}
Solution C
#include <stdio.h> int main() { int a,b; while(scanf("%d %d",&a, &b) != EOF) printf("%d\n",a+b); return 0; }
Solution C++
#include<iostream> using namespace std; int main() { int a,b,c; cin>>a>>b; c=a+b; cout<<c; return 1; }
Hint
#include <stdio.h>
int main()
{
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
}
program p1001(Input,Output);
var
a,b:Integer;
begin
while not eof(Input) do
begin
Readln(a,b);
Writeln(a+b);
end;
end.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int a = in.nextInt();
int b = in.nextInt();
System.out.println(a + b);
}
}
}
a=gets.chomp
b="0"
a.eachline(" "){
|d|
b=b+"+"+d
}
puts eval(b)
read a b
echo ((a+$b))
import sys
for line in sys.stdin:
a = line.split()
print int(a[0]) + int(a[1])
<?php
while (fscanf(STDIN, "%d%d", a, b) == 2) {
print (a + b) . "\n";
}
?>
#! /usr/bin/perl -w
while(<>){
chomp;
(a,b)=split(/\s/,$);
printf "%d\n",a+b;
}
using System;
public class Sum
{
public static void Main()
{
//string token = Console.ReadLine();
//int test = int.Parse(token);
for(int k = 0; k < 1;k++){
string[] tokens = Console.ReadLine().Split(' ');
Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1]));
}
}
}