Last active
December 26, 2015 06:58
-
-
Save sirupsen/7111270 to your computer and use it in GitHub Desktop.
Standard I/O examples in a few languages for Contestrus. You get two numbers from standard input and have to output the sum to standard output.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
input_lines = fs.readFileSync('/dev/stdin').toString().split('\n').map(function(s) { | |
return s.trim(); | |
}); | |
nums = input_lines[0].split(' ').map(Number) | |
console.log(nums[0] + nums[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a, b = gets.split(" ") | |
puts a.to_i + b.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
var a int | |
var b int | |
fmt.Scanf("%d %d\n", &a, &b) | |
fmt.Println(a + b) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python | |
a, b = map(int, raw_input().split(' ')) | |
print a + b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment