23 lines
575 B
Text
23 lines
575 B
Text
[indent=4]
|
|
/*
|
|
A+B in Genie
|
|
valac aplusb-genie.gs
|
|
./aplusb-genie
|
|
*/
|
|
init
|
|
a:int64 = 0
|
|
b:int64 = 0
|
|
leftover:string = ""
|
|
|
|
print "Enter A and B, two numbers separated by space"
|
|
line:string = stdin.read_line()
|
|
res:bool = int64.try_parse(line, out a, out leftover)
|
|
res = int64.try_parse(leftover, out b)
|
|
|
|
warning:string = " outside range (-1000, 1000), but it's ok, no one will tell"
|
|
if a < -1000 or a > 1000
|
|
print "A" + warning
|
|
if b < -1000 or b > 1000
|
|
print "B" + warning
|
|
|
|
print "From %s\nA + B = %llu", line, a+b
|