A+B 문제에서 변수 하나만 더 사용하면 된다.
Bash
bash
read a b c
echo $((a + b + c))
1
2
2
C
c
#include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d", &a, &b, &c);
printf("%d", a+b+c);
return 0;
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Node.js
javascript
let [a, b, c] = require("fs").readFileSync(0).toString().trim().split(" ").map(Number);
console.log(a + b + c);
1
2
2
PHP
php
<?php
fscanf(STDIN, "%d %d", $a, $b, $c);
echo $a + $b + $c;
?>
1
2
3
4
2
3
4
Python3
python
a, b, c = map(int, input().split())
print(a+b+c)
1
2
2
Ruby
ruby
a, b, c = gets.chomp.split().map {|i| i.to_i}
puts a+b+c
1
2
2
Comments
Not supported comment edit and upvote
You can do it on this page if you want.