# A+B

A+B
You are encouraged to solve this task according to the task description, using any language you may know.

A+B   ─── a classic problem in programming contests,   it's given so contestants can gain familiarity with the online judging system being used.

Given two integers,   A and B.

Their sum needs to be calculated.

Input data

Two integers are written in the input stream, separated by space(s):

${\displaystyle (-1000\leq A,B\leq +1000)}$

Output data

The required output is one integer:   the sum of A and B.

Example
input   output
2 2 4
3 2 5

## 11l

Translation of: Python

<lang 11l>print(sum(input().split(‘ ’, group_delimiters' 1B).map(i -> Int(i))))</lang>

## 0815

<lang 0815>|x|+%</lang>

## 360 Assembly

<lang 360asm>* A+B 29/08/2015 APLUSB CSECT

        USING  APLUSB,R12
LR     R12,R15
OPEN   (MYDATA,INPUT)


LOOP GET MYDATA,PG read a single record

        XDECI  R4,PG              input A
XDECI  R5,PG+12           input B
AR     R4,R5              A+B
XDECO  R4,PG+24           edit A+B
XPRNT  PG,36              print A+B
B      LOOP               repeat


ATEND CLOSE MYDATA RETURN XR R15,R15

        BR     R14
LTORG


MYDATA DCB LRECL=24,RECFM=FT,EODAD=ATEND,DDNAME=MYFILE PG DS CL24 record

        DC     CL12' '
YREGS
END    APLUSB


</lang>

Input:
          27          53
123         321
999           1

Output:
          27          53          80
123         321         444
999           1        1000


## 8th

<lang forth>gets dup . space eval n:+ . cr</lang>

## ABAP

<lang ABAP>report z_sum_a_b. data: lv_output type i. selection-screen begin of block input.

 parameters:
p_first type i,
p_second type i.


selection-screen end of block input.

at selection-screen output.

 %_p_first_%_app_%-text  = 'First Number: '.
%_p_second_%_app_%-text = 'Second Number: '.


start-of-selection.

 lv_output = p_first + p_second.
write : / lv_output.</lang>


  A, B : Integer;


begin

  Ada.Integer_Text_Io.Get (Item => A);


procedure A_Plus_B is

  type Small_Integers is range -2_000 .. +2_000;
subtype Input_Values is Small_Integers range -1_000 .. +1_000;
package IO is new Ada.Text_IO.Integer_IO (Num => Small_Integers);
A, B : Input_Values;


begin

  IO.Get (A);
IO.Get (B);
IO.Put (A + B, Width => 4, Base => 10);


end A_Plus_B;</lang>

## Agena

Tested with Agena 2.9.5 Win32 <lang agena>scope

   local f := trim( io.read() ) split " "; # read a line and split into fields
local a := tonumber( f[ 1 ] );
local b := tonumber( f[ 2 ] );
print( a + b )


epocs</lang>

## Aime

<lang aime>file f; list l;

f_affix(f, "/dev/stdin"); f_list(f, l, 0); o_integer(atoi(l[0]) + atoi(l[1])); o_newline();</lang>

## ALGOL 68

Translation of: python
Works with: ALGOL 68 version Standard - no extensions to language used
Works with: ALGOL 68G version Any - tested with release 1.18.0-9h.tiny

### Console

1 2

Output:
         +3


### File

<lang algol68>open(stand in, "input.txt", stand in channel); open(stand out, "output.txt", stand out channel); print((read int + read int))</lang> Input "input.txt":

3 4


Output "output.txt":

         +7


## ALGOL W

<lang algolw>begin

   integer a, b;
write( a + b )


end.</lang>

## Apex

<lang Apex>

static Integer sumOfTwoNums(Integer A, Integer B) {

   return A + B;


}

System.debug('A = 50 and B = 25: ' + sumOfTwoNums(50, 25)); System.debug('A = -50 and B = 25: ' +sumOfTwoNums(-50, 25)); System.debug('A = -50 and B = -25: ' +sumOfTwoNums(-50, -25)); System.debug('A = 50 and B = -25: ' +sumOfTwoNums(50, -25));

Output A = 50 and B = 25: 75 A = -50 and B = 25: -25 A = -50 and B = -25: -75 A = 50 and B = -25: 25

</lang>

## APL

<lang APL> ⎕+⎕ </lang>

## AppleScript

Open the AppleScript Editor and save this as A+B.scpt on your Desktop <lang AppleScript>on run argv

   try
return ((first item of argv) as integer) + (second item of argv) as integer
on error
return "Usage with -1000 <= a,b <= 1000: " & tab & " A+B.scpt a b"
end try


end run</lang>

To make this run in Terminal open the Terminal.app and type osascript ~/Desktop/A+B.scpt -3 78 followed by enter.

Result: 75

## Arc

       (read)))


</lang>

## Argile

Translation of: C
Works with: Argile version 1.0.0

<lang Argile>(: Standard input-output streams :) use std, array Cfunc scanf "%d%d" (&val int a) (&val int b) printf "%d\n" (a + b)</lang> <lang Argile>(: Input file : input.txt :) (: Output file: output.txt :) use std, array let in = fopen "input.txt" "r" let out = fopen "output.txt" "w" let int x, y. Cfunc fscanf in "%d%d" (&x) (&y) (:fscanf not yet defined in std.arg:) fprintf out "%d\n" (x+y) fclose in fclose out</lang>

## ARM Assembly

Works with: gcc version Linux

Todo: -need to print numbers w/o the leading 0's. Replace them with spaces, so alignment is still the same.

Read two strings from stdin, convert to integers calculate their sum, print to stdout. A valid int is a value between -2^31 (-2147483647) and 2^31-1 (2147483647). We do not allow -2147483648 as input, but it is a valid result. E.g. -1 -2147483647. Maximum number of digits is 10. Leading 0's are counted as number length. We read signed values. We ignore leading '+'s and allow '-' for negative values. If multiple plus or minus signs precede a number, only the last one counts. minval and maxval can be used to specify any valid range, (e.g. -1000 and +1000). The range is inclusive. If 0 is specified for both ranges, range checks are not done.

Tested on RaspberryPi model B (GNU/Linux, ARMv6) Save in ab.S Build with: <lang ARM_Assembly>as -o ab.o ab.S ld -o a.out ab.o</lang>

<lang ARM_Assembly>.data

  .align   2
.code 32


.section .rodata

  .align   2
.code 32


overflow_msg: .ascii "Invalid number. Overflow.\n" overflow_msglen = . - overflow_msg bad_input_msg: .ascii "Invalid input. NaN.\n" bad_input_msglen = . - bad_input_msg range_err_msg: .ascii "Value out of range.\n" range_err_msglen = . - range_err_msg io_error_msg: .ascii "I/O error.\n" io_error_msglen = . - range_err_msg

sys_exit = 1 sys_read = 3 sys_write = 4 max_rd_buf = 14 lf = 10 m10_9 = 0x3b9aca00 maxval = 1000 minval = -1000

.text

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ void main() @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type _start STT_FUNC
.global _start


_start:

  stmfd   sp!, {r4,r5,lr}


  ldr r0, =max_rd_buf
mov r4, r0
bl printint
mov r0, r4
bl range_check


  ldr r0, =max_rd_buf
mov r5, r0
bl printint
mov r0, r5
bl range_check


.sum_and_print:

  adds r0, r4, r5
bvs overflow
bl printint


.main_exit:

  mov r0, #0
bl exit
ldmfd   sp!, {r4,r5,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ Read from stdin until we encounter a non-digit, or we have read bytes2rd digits. @@ Ignore leading spaces. @@ Return value to the caller converted to a signed int. @@ We read positive values, but if we read a leading '-' sign, we convert the @@ return value to two's complement. @@ The argument is max number of bytes to read from stdin. @@ int readint(int bytes2rd) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32


  stmfd   sp!, {r4,r5,r6,r7,lr}
@@@@@@@@@@@@@@@
@@ r0 : #0 for stdin arg to read.
@@ r1 : ptr to current pos in local buffer.
@@ r2 : #1 to read one byte at a time.
@@ r3,r7 : tmp.
@@ r4 : number of bytes read.
@@ r5 : value of current byte.
@@@@@@@@@@@@@@@
sub sp, sp, r0
mov r1, sp
mov r3, #0
push {r3}        @ sp,#4: local var @isnegative. return in r1. Default value is 0/false. Positive number.
push {r0}        @ sp,#0: local var @maxbytes. const.
mov r2, #1
mov r4, #0

  mov r6, #0
b .rd


@ we get here if r6 is 0. @ if space, goto .rd. @ else set r6 to 1 and goto .noleading. .leadchk:

  mov r0, r5
bl isspace
cmp r0, #1
beq .rd


.sign_chk:

  mov r0, r5
push {r1}
bl issign
cmp r0, #1
streq r0, [sp,#8]   @ sp,#4 + 4 for the pushed r1.
movhi r1, #0
strhi r1, [sp,#8]   @ sp,#4 + 4 for the pushed r1.
pop {r1}
bhs .rd

  mov r6, #1


.rd:

  mov r0, #0
cmp r0, #1
bne .sum_digits_eof  @ eof
mov r5, #0
ldrb r5, [r1]
cmp r6, #0


  mov r0, r5
bl isdigit
cmp r0, #1
bne .sum_digits_nan @ r5 is non-digit

  add r4, r4, #1
@ max chars to read is received in arg[0], stored in local var at sp.
@ Only 10 can be valid, so the default of 12 leaves space for separator.
ldr r3, [sp]
cmp r4, r3
beq .sum_digits_maxrd  @ max bytes read.
b .rd


  @@@@@@@@@@@@@@@
@ We have read r4 (0..arg[0](default 12)) digits when we get here. Go through them
@ and add/mul them together to calculate a number.
@ We multiply and add the digits in reverse order to simplify the multiplication.
@@@@@@@@@@@@@@@
@ r0: return value.
@ r1: local variable for read buffer.
@ r2: tmp for conversion.
@ r3,r6,r7: tmp
@ r4: number of chars we have read.
@ r5: multiplier 1,10,100.
@@@@@@@@@@@@@@@


.sum_digits_nan:

  mov r0, r5
bl isspace
cmp r0, #1


.sum_digits_maxrd: .sum_digits_eof:

  mov r0, #0
mov r5, #1


.count:

  cmp r4, #0
sub r4, r4, #1
sub r1, #1
ldrb r2, [r1]
sub r2, r2, #48
mov r3, r2

  @ multiply r3 (char value of digit) with r5 (multiplier).
@ possible overflow.
@ MI means negative.
@ smulls multiples two signed 32 bit vals and returns a 64 bit result.
@ If we get anything in r7, the value has overflowed.
@ having r2[31] set is overflow too.
smulls r2, r7, r3, r5
cmp r7, #0
bne overflow
cmp r2, #0
bmi overflow

  @@ possible overflow.
bvs overflow
bmi overflow

  @@ end of array check.
@@ check is needed here too, for large numbers, since 10 billion is not a valid 32 bit val.
cmp r4, #0

  @@ multiple multiplier by 10.
@@ possible overflow.
@@ too many digits is input. happens if input is more than 10 digits.
mov r3, #10
mov r6, r5
smulls r5, r7, r3, r6
cmp r7, #0
bne overflow
cmp r5, #0
bmi overflow
b .count


  ldr r1, [sp,#4] @ read isnegative value.
cmp r1, #0
rsbne r0, r0, #0
pop {r2}
ldmfd   sp!, {r4,r5,r6,r7,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ int isdigit(int) @@ #48..#57 ascii range for '0'..'9'. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type isdigit STT_FUNC
.global isdigit


isdigit:

  stmfd   sp!, {r1,lr}
cmp r0, #48
blo .o_range
cmp r0, #57
bhi .o_range
mov r0, #1
ldmfd   sp!, {r1,pc}


.o_range:

  mov r0, #0
ldmfd   sp!, {r1,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ int isspace(int) @@ ascii space = 32, tab = 9, newline 10, cr = 13. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type isspace STT_FUNC
.global isspace


isspace:

  stmfd   sp!, {lr}
cmp   r0, #32
cmpne r0, #9
cmpne r0, #10
cmpne r0, #13
beq .is_space
mov r0, #0
ldmfd   sp!, {pc}


.is_space:

  mov r0, #1
ldmfd   sp!, {pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ Return value is 1 for '-' 2 for '+'. @@ int isspace(int) @@ '+' = 43 and '-' = 45. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type issign STT_FUNC
.global issign


issign:

  stmfd   sp!, {lr}
cmp   r0, #43
beq .plus_sign
cmp r0, #45
beq .minus_sign
mov r0, #0
ldmfd   sp!, {pc}


.plus_sign:

  mov r0, #2
ldmfd   sp!, {pc}


.minus_sign:

  mov r0, #1
ldmfd   sp!, {pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ ARGS: @@ r0 : in out arg (current int value) @@ r1 : in out arg (ptr to current pos in buffer) @@ r2 : in arg (const increment. 1000_000_000, 100_000_000, 10_000_000, 1000_000, 100_000, 10_000, 1000, 100, 10, 1.) @@ @@ r4 : tmp local. Outer scope must init to #10 and count down to #0. @@ Special case is INTMAX. Must init to 5 if r4 >= 1000_000_000 (0x3b9aca00 = m10_9). @@ r5: tmp @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type get_digit STT_FUNC
.global get_digit


get_digit:

  stmfd  sp!, {r2,r4,r5,lr}
ldr r5, =m10_9
cmp r2, r5
movlo r4, #10
movhs r4, #5


.get_digit_loop:

  sub r4, #1
mul r5, r4, r2
cmp r0, r5
blo .get_digit_loop
sub r0, r5
strb r4, [r1], #1
ldmfd   sp!, {r2,r4,r5,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ A quick way to divide (numbers evenly divisible by 10) by 10. @@ Most ARM cpus don't have a divide instruction, @@ so this will always work. @@ A generic div function is long and not needed here. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


.div_r2_10:

  stmfd   sp!, {r0,r1,r3,lr}
mov r0, #1
mov r1, #10


.find_x:

  mul r3, r0, r1;
cmp r3, r2
movlo r0, r3
blo .find_x
mov r2, r0
ldmfd   sp!, {r0,r1,r3,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


.print_neg_sign:

  stmfd   sp!, {r0,r1,r2,lr}
@ 45 = '-'
mov r1, #45
push {r1}
mov r2, #1
@ r1 is ptr to our local variable (holding '-').
mov r1, sp
mov r0, #1
bl write
cmp r0, #0
blne io_error
pop {r1}
ldmfd   sp!, {r0,r1,r2,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ void printint(int val) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type printint STT_FUNC
.global printint


printint:

  stmfd   sp!, {r4,r5,r6,lr}
mov r1, #1
ands r1, r1, r0, LSR #31
rsbne r0, r0, #0
blne .print_neg_sign
sub sp, sp, #20
mov r1, sp
mov r3, sp

  ldr r2, =m10_9


.getc_loop:

  bl get_digit
cmp r2, #1
beq .exit_getc_loop
bl .div_r2_10
b .getc_loop


.exit_getc_loop:

  ldr r0, =lf
strb r0, [r1], #1

  sub r2, r1, r3
mov r1, r3
mov r0, #1
bl write
cmp r0, #0
blne io_error
ldmfd   sp!, {r4,r5,r6,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


range_check:

  stmfd   sp!, {r4,r5,lr}
ldr r4, =minval
ldr r5, =maxval
cmp   r4, #0
cmpeq r5, #0
beq .skip_range_check
cmp r0, r4
bllt range_err
cmp r0, r5
blgt range_err


.skip_range_check:

  ldmfd   sp!, {r4,r5,pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ void range_err() @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


range_err:

  stmfd   sp!, {lr}
ldr r2, =range_err_msglen
ldr r1, =range_err_msg
mov r0, #2
bl write
mov   r0, #-1
bl exit
ldmfd   sp!, {pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ void overflow() @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


overflow:

  stmfd   sp!, {lr}
ldr r2, =overflow_msglen
ldr r1, =overflow_msg
mov r0, #2
bl write
mov   r0, #-1
bl exit
ldmfd   sp!, { pc}


  .align   2


  stmfd   sp!, {lr}
mov r0, #2
bl write
mov   r0, #-1
bl exit
ldmfd   sp!, {pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ void io_error() @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2


io_error:

  stmfd   sp!, {lr}
ldr r2, =io_error_msglen
ldr r1, =io_error_msg
mov r0, #2
bl write
mov   r0, #-1
bl exit
ldmfd   sp!, {pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ void exit(int) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type _start STT_FUNC
.global exit


exit:

  stmfd   sp!, {r7, lr}
ldr r7, =sys_exit
svc #0
ldmfd   sp!, {r7, pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ int write(int fd,char*buf,int len) @ Return 0 if we successfully write all bytes. Otherwise return the error code. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type _start STT_FUNC
.global write


write:

  stmfd   sp!, {r4,r7, lr}
mov r4, r2


.wr_loop:

  ldr r7, =sys_write
svc #0
@ If r0 is negative, it is more than r4 with LO (unsigned <).
cmp r0, r4
sublo r4, r0
blo .wr_loop
moveq r0, #0
ldmfd   sp!, {r4,r7, pc}


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ int read(int fd,char*buf,int len) @ Return number of bytes successfully read. Ignore errors. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  .align   2
.code 32
.type _start STT_FUNC


  stmfd   sp!, {r7, lr}
svc #0
cmp r0, #0
movlt r0, #0
ldmfd   sp!, {r7, pc}


</lang>

<Lang AsciiDots>

&-#$-\  .-#?-[+] .-#?--/ </Lang> ## ATS <lang ATS> (* ****** ****** *) // 1. include "share/atspre_staload.hats" // staload UN =$UNSAFE // (* ****** ****** *)

(* ****** ****** *)

implement main0() = let

 var A: int
var B: int
val () =
$extfcall (void, "scanf", "%d%d", addr@A, addr@B) // end of [val]  in  println! ($UN.cast2int(A) + $UN.cast2int(B))  end // end of [main0] (* ****** ****** *) </lang> ## AutoHotkey <lang AutoHotkey>InputBox, input , A+B, Two integer numbers, separated by space. StringSplit, output, input, %A_Space% msgbox, % output1 . "+" . output2 "=" output1+output2</lang> ## AutoIt <lang AutoIt>;AutoIt Version: 3.2.10.0$num = "45 54" consolewrite ("Sum of " & $num & " is: " & sum($num)) Func sum($numbers) $numm = StringSplit($numbers," ") Return$numm[1]+$numm[$numm[0]]


EndFunc</lang>

### Example2

This version can handle any amount of numbers in the input: <lang AutoIt>ConsoleWrite("# A+B:" & @CRLF)

Func Sum($inp) Local$num = StringSplit($inp, " "),$sum = 0 For $i = 1 To$num[0]

~ ConsoleWrite("# num["&$i&"] " &$num[$i] & @CRLF) ;;$sum = $sum +$num[$i] Next Return$sum EndFunc ;==>Sum

$inp = "17 4"$res = Sum($inp) ConsoleWrite($inp & " --> " & $res & @CRLF)$inp = "999 42 -999" ConsoleWrite($inp & " --> " & Sum($inp) & @CRLF)

In calculations, text counts as 0,
so the program works correctly even with this input

Local $inp = "999x y 42 -999",$res = Sum($inp) ConsoleWrite($inp & " --> " & $res & @CRLF)</lang> Output: # A+B: 17 4 --> 21 999 42 -999 --> 42 999x y 42 -999 --> 42 ## AWK <lang awk>{print$1 + $2}</lang> ## Batch File Prompts version <lang dos>::aplusb.cmd @echo off setlocal set /p a="A: " set /p b="B: " set /a c=a+b echo %c% endlocal</lang> All on the commandline version <lang dos>::aplusb.cmd @echo off setlocal set a=%1 set b=%2 set /a c=a+b echo %c% endlocal</lang> Formula on the command line version <lang dos>::aplusb.cmd @echo off setlocal set /a c=%~1 echo %c% endlocal</lang> Example of 'Formula on the command line version' >aplusb 123+456 579 >aplusb "1+999" 1000  Parse the input stream version (thanks to Tom Lavedas on alt.msdos.batch.nt) <lang dos>::aplusb.cmd @echo off setlocal set /p a="Input stream: " call :add %a% echo %res% endlocal goto :eof add set /a res=res+%1 shift if "%1" neq "" goto :add</lang> Example of 'parse the input stream version' >aplusb Input stream: 1234 5678 6912 >aplusb Input stream: 123 234 345 456 567 678 789 890 4082 ## BASIC <lang qbasic>DEFINT A-Z tryagain: backhere = CSRLIN INPUT "", i$ i$= LTRIM$(RTRIM$(i$)) where = INSTR(i$, " ") IF where THEN  a = VAL(LEFT$(i$, where - 1)) b = VAL(MID$(i$, where + 1)) c = a + b LOCATE backhere, LEN(i$) + 1
PRINT c


ELSE

   GOTO tryagain


END IF</lang>

<lang basic256>dim a(2) input "Enter two numbers separated by a space?", t$a = explode(t$," ") print t$+ " " + (a[0] + a[1])</lang> ### BBC BASIC <lang bbc> REPEAT  hereY% = VPOS INPUT LINE "" q$
hereX% = LEN(q$) + 1 WHILE LEFT$(q$, 1) = " " q$ = MID$(q$, 2)
ENDWHILE
space% = INSTR(q$, " ") IF space% THEN a = VAL(LEFT$(q$, space% - 1)) b = VAL(MID$(q$, space% + 1)) PRINT TAB(hereX%, hereY%) ; a + b ENDIF UNTIL FALSE</lang>  That seems overly complicated. What's wrong with: <lang bbc> REPEAT  INPUT LINE "" q$

### Sinclair ZX81 BASIC

<lang basic>10 INPUT A$20 LET I=1 30 IF A$(I)=" " THEN GOTO 60 40 LET I=I+1 50 GOTO 30 60 PRINT VAL A$( TO I-1)+VAL A$(I+1 TO )</lang>

## bc

Works with: GNU bc

## Befunge

<lang befunge>&&+.@</lang>

## Bird

<lang Bird>use Console Math

define Main

   $a Console.Read$b Console.Read
Console.Println Math.Add $a$b


end</lang>

## BlooP

BlooP and FlooP can't actually read from stdin, but here's the procedure it would use, if it could. <Lang BlooP> DEFINE PROCEDURE ADD [A, B]: BLOCK 0: BEGIN

   OUTPUT <= A + B;


BLOCK 0: END. </Lang>

## Bracmat

filter is a pattern that checks that input is a non-fractional number not less than -1000 and not greater than 1000. The filter is applied to each input. <lang bracmat>( out $( put$"Enter two integer numbers between -1000 and 1000:"

   & (filter=~/#%:~<-1000:~>1000)
& get':(!filter:?a) (!filter:?b)
& !a+!b
| "Invalid input. Try again"
)


);</lang>

## Brainf***

<lang brainf***>INPUT AND SUMMATION TODO if first symbol is a minus sign print Qgo awayQ +> initialize sum to one ++[ loop for each input ie twice

   [>>,----------[----------------------[-<+>]]<]      eat digits until space or newline
<[<]>>>
>[<                                                 until no next digit
----------------                                    subtract ascii zero minus what we subtracted above
[->++++++++++<]                                     add ten timess that to the next digit
<[->+<]<[->+<]>>                                    shift sum and loop counter
>>
]
<----------------                                   subtract as above from last digit as well
<-


] <- subtract original one from sum

OUTPUT [ while a number divided by ten is bigger than zero

   [->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->--------->+<<[->>>+<<<]]]]]]]]]]>>>[-<<<+>>>]<<<]   divide by ten
>++++++++++++++++++++++++++++++++++++++++++++++++>                                                  convert remainder to ascii digit


] <[.<<] print ascii digits</lang>

## Brat

<lang brat>numbers = g.split[0,1].map(:to_i) p numbers[0] + numbers[1] #Prints the sum of the input</lang>

## Burlesque

<lang burlesque>ps++</lang>

## C

<lang c>// Standard input-output streams

1. include <stdio.h>

int main() {

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


}</lang> <lang c>// Input file: input.txt // Output file: output.txt

1. include <stdio.h>

int main() {

  freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;


}</lang> <lang c>

1. include <stdio.h>
2. include <stdlib.h>

int main(int argc, char **argv) //not sure if argv counts as input stream... certainly it is brought here via input stream. {

  printf("%d\n", atoi(*(argv+1)) + atoi(*(argv+2)));
return 0;


} </lang>

## C#

<lang csharp>using System; using System.Linq;

class Program {

   static void Main()
{
}


}</lang> Another way (not recommended since it does not work with more than two numbers): <lang csharp>using System;

class Program {

   static void Main()
{
int index = input.IndexOf(" ");
int num1 = int.Parse(input.Substring(0, index));
int num2 = int.Parse(input.Substring(index + 1));
int sum = num1 + num2;
Console.WriteLine(sum.ToString());
}


}</lang>

## C++

<lang cpp>// Standard input-output streams

1. include <iostream>

using namespace std; int main() {

  int a, b;
cin >> a >> b;
cout << a + b << endl;


}</lang> <lang cpp>// Input file: input.txt // Output file: output.txt

1. include <fstream>

using namespace std; int main() {

  ifstream in("input.txt");
ofstream out("output.txt");
int a, b;
in >> a >> b;
out << a + b << endl;
return 0;


}</lang>

## Ceylon

<lang ceylon>shared void run() {

   print("please enter two numbers for me to add");
if (exists input) {
value tokens = input.split().map(Integer.parse);
if (tokens.any((element) => element is ParseException)) {
return;
}
value numbers = tokens.narrow<Integer>();
if (numbers.size != 2) {
}
else if (!numbers.every((Integer element) => -1k <= element <= 1k)) {
print("only numbers between -1000 and 1000, please");
}
else if (exists a = numbers.first, exists b = numbers.last) {
print(a + b);
}
else {
print("something went wrong");
}
}


}</lang>

## Clojure

<lang clojure>(println (+ (Integer/parseInt (read-line)) (Integer/parseInt (read-line)))) 3 4 =>7</lang> <lang clojure>(eval (read-string (str "(+ " (read-line) " )") )) 3 3 6</lang>

Translation of Common Lisp version: <lang clojure>(println (+ (read) (read))) 3 4 7</lang>

Safely and without reader tricks: <lang clojure>(let [ints (map #(Integer/parseInt %) (clojure.string/split (read-line) #"\s") )]

 (println (reduce + ints)))


3 4 =>7</lang>

or same as above, but without "let": <lang clojure>(println (reduce + (map #(Integer/parseInt %) (clojure.string/split (read-line) #"\s") )))

3 4 =>7</lang>

## COBOL

<lang cobol> IDENTIFICATION DIVISION.

      PROGRAM-ID. A-Plus-B.

      DATA DIVISION.
WORKING-STORAGE SECTION.
01  A       PIC S9(5).
01  B       PIC S9(5).

      01  A-B-Sum PIC S9(5).

      PROCEDURE DIVISION.
ACCEPT A
ACCEPT B

          ADD A TO B GIVING A-B-Sum

          DISPLAY A-B-Sum

          GOBACK
.</lang>


## CoffeeScript

Translation of: JavaScript

<lang html4strict><html> <script type="text/javascript" src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js"></script> <script type="text/coffeescript"> a = window.prompt 'enter A number', b = window.prompt 'enter B number', document.getElementById('input').innerHTML = a + ' ' + b sum = parseInt(a) + parseInt(b) document.getElementById('output').innerHTML = sum </script> <body>

</body> </html></lang>

Works with: Node.js

<lang coffeescript> { stdin } = process sum = ( a, b ) -> a + b

display = ( messages... ) -> console.log messages...

parse = ( input ) ->

   parseInt x for x in ( x.trim() for x in input.split ' ' ) when x?.length


check = ( numbers... ) ->

   return no for x in numbers when isNaN x
return no for x in numbers when not ( -1000 < x < 1000 )
yes


prompt = ->

   display 'Please enter two integers between -1000 and 1000, separated by a space:'
stdin.once 'data', ( data ) ->
[ a, b ] = parse data
if check a, b
display "#{ a } + #{ b } = #{ sum a, b }"
else
display "Invalid input: #{ a }, #{ b }"
do prompt
return

1. Resume input and set the incoming encoding.

stdin.resume() stdin.setEncoding 'utf8'

1. Start the main loop.

do prompt </lang>

## Component Pascal

BlackBox Component Builder <lang oberon2> MODULE AB; IMPORT StdLog, DevCommanders,TextMappers;

PROCEDURE DoAB(x,y: INTEGER); BEGIN

       StdLog.Int(x);StdLog.Int(y);StdLog.Int(x + y);StdLog.Ln;


END DoAB;

PROCEDURE Go*; VAR

               params: DevCommanders.Par;
s: TextMappers.Scanner;
p : ARRAY 2 OF INTEGER;
current: INTEGER;


BEGIN

       current := 0;
params := DevCommanders.par;
s.ConnectTo(params.text);
s.SetPos(params.beg);
s.Scan;
WHILE(~s.rider.eot) DO
IF (s.type = TextMappers.int) THEN
p[current] := s.int; INC(current);
END;
s.Scan;
END;
IF current = 2 THEN DoAB(p[0],p[1]) END;


END Go; END AB. </lang> Execute: AB.Go 12 23 ~

Output:
12 23 35


## Computer/zero Assembly

<lang czasm> STP  ; wait for input a: 0 b: 0

       LDA  a
STP</lang>


## Crystal

<lang ruby>puts gets.not_nil!.split.map(&.to_i).sum</lang>

The not_nil! call on gets is needed because gets might return nil and the compiler forces us to deal with it. In the case of nil a runtime exception will be thrown.

To handle the nil case we could do:

<lang ruby>if line = gets

 puts line.split.map(&.to_i).sum


else

 puts "No input"


end</lang>

## D

### From Console

<lang d>import std.stdio, std.conv, std.string;

void main() {

   string[] r;
try
catch (StdioException e)
r = ["10", "20"];

   writeln(to!int(r[0]) + to!int(r[1]));


}</lang>

Output:
30

### From File

<lang d>void main() {

   import std.stdio, std.file;

   immutable ab = "sum_input.txt".slurp!(int, int)("%d %d")[0];
"sum_output.txt".File("w").writeln(ab[0] + ab[1]);


}</lang>

## Dart

<lang Dart>import 'dart:io';

// a little helper function that checks if the string only contains // digits and an optional minus sign at the front bool isAnInteger(String str) => str.contains(new RegExp(r'^-?\d+$')); void main() {  while(true) { String input = stdin.readLineSync(); var chunks = input.split(new RegExp(r'[ ]+')); // split on 1 or more spaces if(!chunks.every(isAnInteger)) { print("not an integer!"); } else if(chunks.length > 2) { print("too many numbers!"); } else if(chunks.length < 2) { print('not enough numbers!'); } else { // parse the strings into integers var nums = chunks.map((String s) => int.parse(s)); if(nums.any((num) => num < -1000 || num > 1000)) { print("between -1000 and 1000 please!"); } else { print(nums.reduce((a, b) => a + b)); } } }  } </lang> Output: 1 2 3 3 4 7 ## dc <lang dc>? + psz</lang> The question mark ? reads and executes a line of input. The user must enter a dc program that pushes two numbers to the stack, such as 2 3 or 5 _1. (The user must use underscore _ for negative numbers.) ## DCL <lang DCL>$ read sys$command line$ a = f$element( 0, " ", line )$ b = f$element( 1, " ", line )$ write sys$output a, "+", b, "=", a + b</lang> ## Déjà Vu Translation of: Python ### Console <lang dejavu>0 for k in split !prompt "" " ": + to-num k !print</lang> ## Delphi Console version. <lang delphi>program SUM; {$APPTYPE CONSOLE}

uses

 SysUtils;


procedure var

 s1, s2:string;


begin

 ReadLn(s1);
Writeln(StrToIntDef(s1, 0) + StrToIntDef(s2,0));


end.</lang>

## DMS

<lang DMS>number a = GetNumber( "Please input 'a'", a, a ) // prompts for 'a' number b = GetNumber( "Please input 'b'", b, b ) // prompts for 'b' Result( a + b + "\n" )</lang>

## Dragon

<lang dragon> select "graphic" select "types"

a = int(prompt("Enter A number")) b = int(prompt("Enter B number"))

showln a + b </lang>

## DWScript

Ghetto GUI version <lang delphi>var a := StrToInt(InputBox('A+B', 'Enter 1st number', '0')); var b := StrToInt(InputBox('A+B', 'Enter 2nd number', '0')); ShowMessage('Sum is '+IntToStr(a+b));</lang>

## EasyLang

<lang>a$= input a$[] = str_split a$while i < len a$[] and a$[i] <> " "  i += 1  . if i < len a$[]

 a = number substr a$0 i b = number substr a$ i -1
print a + b


.</lang>

## EchoLisp

<lang scheme> (+ (read-number 1 "value for A") (read-number 2 "value for B")) </lang>

## EDSAC order code

The EDSAC does not support input of data while a program is running, so A and B are pre-set to 37 and 28. Other values can of course be substituted: note the slightly idiosyncratic format in which integer data is written (the least significant bit set using an alphabetic character). The result of the computation is displayed in binary in the first address of storage tank 3. <lang edsac>[ A plus B

 ========

A program for the EDSAC

the sum at the top of storage
tank 3

 Works with Initial Orders 2 ]


[ Orders ]

T96F [ Clear accumulator ] A5@ [ Acc += C(theta + 5) ] A6@ [ Acc += C(theta + 6) ] T96F [ C(96) = Acc; Acc = 0 ]

ZF [ Halt ]

[ Pseudo-orders (data) ]

P18D [ 5@: 18*2 + 1 = 37 ] P14F [ 6@: 14*2 + 0 = 28 ]

EZPF [ Branch to load point ]</lang>

Output:
00000000001000001

## Eiffel

argument(0) contains the path of the executable - thus we start at argument(1) <lang eiffel> class APPLICATION inherit ARGUMENTS create make feature {NONE} -- Initialization make -- Run application. do print(argument(1).to_integer + argument(2).to_integer) end end </lang>

Alternatively ... <lang eiffel> make -- Run application. note synopsis: "[ The specification implies command line input stream and also implies a range for both A' and B' (e.g. (-1000 <= A,B <= +1000)). To test in Eiffel Studio workbench, one can set Execution Parameters of "2 2", where the expected output is 4. One may also create other test Execution Parameters where the inputs are out-of-bounds and confirm the failure. ]" do if attached {INTEGER} argument (1).to_integer as a and then attached {INTEGER} argument (2).to_integer as b and then (a >= -1000 and b >= -1000 and a <= 1000 and b <= 1000) then print (a + b) else print ("Either argument 1 or 2 is out-of-bounds. Ensure: (-1000 <= A,B <= +1000)") end end </lang>

## Ela

<lang ela>open monad io string list

a'b() = do

 str <- readStr
putStrLn <| show <| sum <| map gread <| string.split " " <| str


a'b() ::: IO</lang>

Output:
1 2 3 4 5 6
21

## Elena

ELENA 4.x : <lang elena>import extensions;

public program() {

   var A := new Integer();
var B := new Integer();



}</lang>

Or more generic solution: <lang elena>import system'routines; import extensions;

public program() {

   console.printLine(console.readLine()
.split()
.selectBy(__mssg toInt<convertorOp>[0])
.summarize())


}</lang>

## Elixir

<lang Elixir>IO.gets("Enter two numbers seperated by a space: ")

 |> String.split
|> Enum.map(&String.to_integer(&1))
|> Enum.sum
|> IO.puts</lang>


## Elm

<lang Elm> --To write this function directly run cmd --Type elm-repl to start --Next enter this code sum x y=x+y

--This creates a sum function --When you enter sum A B --You get output as A+B : number --Task done! --END

</lang>

## Emacs Lisp

<lang Emacs Lisp>;; Write this code in a file: a+b.el

Put input.txt in the same directory than a+b.el
Open a+b.el in emacs and run the program with
M-x eval-buffer

(defun solve (xs) (mapcar (lambda (ys) (apply '+ ys)) xs))

(with-temp-buffer

 (insert-file-contents "input.txt")
(setq content (split-string (buffer-string) "\n" t))
(setq xs (mapcar (lambda (zs) (mapcar #'string-to-number (split-string zs))) content))
(delete-other-windows)
(find-file-other-window "output.txt")
(erase-buffer)
(insert (mapconcat (lambda (x) (format "%d" x)) (solve xs) "\n"))
(save-buffer))


</lang>

## Erlang

<lang erlang>-module(aplusb). -export([start/0]).

start() ->

   case io:fread("","~d~d") of
eof -> ok;
{ok, [A,B]} ->
io:format("~w~n",[A+B]),
start()
end.</lang>


## ERRE

<lang ERRE> PROGRAM SUM2

BEGIN

 LOOP
INPUT(LINE,Q$) EXIT IF Q$=""
1.2 2.3
3.5

## TypeScript

function add(a: number, b: number) {
return a+b;
}


## UNIX Shell

Works with: Bourne Shell

<lang sh>#!/bin/sh read a b || exit echo expr "$a" + "$b"</lang>

Works with: bash
Works with: ksh93
Works with: pdksh
Works with: zsh

## Ursa

<lang>#

1. a + b
1. read a string containing the two ints

decl string input set input (in string console)

1. determine the sum

decl int sum set sum (int (+ sum (int (split input " ")<0>))) set sum (int (+ sum (int (split input " ")<1>)))

1. output the sum

out sum endl console</lang>

## Ursala

Using standard input and output streams: <lang Ursala>#import std

1. import int
1. executable&

main = %zP+ sum:-0+ %zp*FiNCS+ sep @L</lang> Overwriting a text file named as a command line parameter: <lang Ursala>#import std

1. import int
1. executable -[parameterized]-

main = ~command.files.&h; <.contents:= %zP+ sum:-0+ %zp*FiNCS+ sep @L+ ~contents></lang> Creating a new file named after the input file with suffix .out: <lang Ursala>#import std

1. import int
1. executable -[parameterized]-

main =

end
endfunction



endmodule</lang>

## VHDL

<lang VHDL>LIBRARY std; USE std.TEXTIO.all;

entity test is end entity test;

architecture beh of test is begin

 process
variable line_in, line_out : line;
variable a,b : integer;
begin

write(line_out, a+b);
writeline(OUTPUT, line_out);
wait; -- needed to stop the execution
end process;


end architecture beh;</lang>

## Visual Basic .NET

<lang vbnet>Module Module1

 Sub Main()
Dim s() As String = Nothing

   s = Console.ReadLine().Split(" "c)
Console.WriteLine(CInt(s(0)) + CInt(s(1)))
End Sub


End Module</lang>

## Wee Basic

<lang Wee Basic>Print 1 "Enter number A:" input a Print 1 "Enter number B:" input b let c=a+b print 1 c end</lang>

## Whitespace

<lang whitespace>

</lang>

## Wren

<lang wren>import "io" for Stdin var a = Num.fromString(Stdin.readLine()) var b = Num.fromString(Stdin.readLine()) System.print(a + b) </lang>

## X86 Assembly

Works with: NASM version Linux

<lang asm>section .text global _start

_print: mov ebx, 1 mov eax, 4 int 0x80 ret

_get_input: mov edx, 4 mov ebx, 0 mov eax, 3 int 0x80 ret

_start: mov edx, in_val_len mov ecx, in_val_msg call _print mov ecx, a call _get_input ;make 'a' an actual number rather than a char. sub dword [a], 0x30 mov edx, in_val_len mov ecx, in_val_msg call _print mov ecx, b call _get_input ;calc real number for 'b' sub dword [b], 0x30 mov eax, dword [a] mov ebx, dword [b] add eax, ebx ;get the character for our sum. add eax, 0x30 mov dword [sum], eax mov edx, out_val_len mov ecx, out_val_msg call _print mov [sum+1], dword 0xa mov edx, 4 mov ecx, sum call _print push 0x1 mov eax, 1 push eax int 0x80 ret

section .data in_val_msg db "Please input an integer:",0 in_val_len equ $-in_val_msg out_val_msg db "The sum of a+b is: ",0 out_val_len equ$-out_val_msg

section .bss a resd 1 b resd 1 sum resd 1</lang> This will not work on numbers over 0(from 1 to 0). This is due to the fact, numbers higher than 0(10,11, etc) are in fact strings when taken from the keyboard. A much longer conversion code is required to loop through and treat each number in the string as separate numbers. For example, The number '10' would have to be treated as a 1 and a 0.

<lang xEec>i# i# ma h#10 r o# p o$p</lang> ## XLISP <lang xlisp>(DEFUN A-PLUS-B ()  (DISPLAY "Enter two numbers separated by a space.") (NEWLINE) (DISPLAY "> ") (DEFINE A (READ)) (DEFINE B (READ)) (+ A B))</lang>  Output: (A-PLUS-B) Enter two numbers separated by a space. > 2 2 4 ## XPL0 <lang XPL0>include c:\cxpl\codes; int A, B; [A:= IntIn(0); B:= IntIn(0); IntOut(0, A+B); CrLf(0);  ]</lang> ## Yabasic <lang Yabasic>repeat  input "Enter two numbers (betwen -1000 ... +1000): " a, b  until(valid(a) and valid(b)) print "\nThe sum of ", a, " and ", b, " is: ", a + b sub valid(x)  return x >= -1000 and x <= 1000  end sub</lang> ## Yorick <lang yorick>a = b = 0; read, a, b; write, a + b;</lang> ## ZED Source -> http://ideone.com/WLtEfe Compiled -> http://ideone.com/fMt6ST <lang zed>(A+B) comment: 1. true (+) (read) (read) (+) one two comment: 1. true (003) "+" one two (read) comment: 1. true (001) "read"</lang> ## zkl <lang zkl>do(2){ask("A B: ").split(" ").filter().sum().println()}</lang> A B: 123 567 690 A B: -4 6 2  This actually works for any number of integers ## ZX Spectrum Basic <lang zxbasic>10 PRINT "Input two numbers separated by"'"space(s) " 20 INPUT LINE a$ 30 GO SUB 90 40 FOR i=1 TO LEN a$50 IF a$(i)=" " THEN LET a=VAL a$( TO i): LET b=VAL a$(i TO ): PRINT a;" + ";b;" = ";a+b: GO TO 70 60 NEXT i 70 STOP 80 REM LTrim operation 90 IF a$(1)=" " THEN LET a$=a$(2 TO ): GO TO 90 100 RETURN</lang> Another solution <lang zxbasic>10 PRINT "Input two numbers separated by"'"space(s) " 20 INPUT LINE a$ 30 LET ll=10e10: LET ls=0: LET i=1 40 IF a$(i)=" " THEN LET ls=i: GO TO 60 50 LET ll=i 60 IF ls>ll THEN GO TO 80 70 LET i=i+1: GO TO 40 80 LET a=VAL a$( TO i): LET b=VAL a\$(i TO ) 90 PRINT a;" + ";b;" = ";a+b</lang>

Input two numbers separated by
space(s)
3.14     2^3
3.14 + 8 = 11.14


## zonnon

<lang zonnon> module ABProblem; var a,b: integer; begin read(a,b); writeln(a+b) end ABProblem. </lang>

1 2
3