Input/Output for pairs of numbers: Difference between revisions
Content added Content deleted
(→{{header|C++}}: removed new's) |
|||
Line 421: | Line 421: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|jq}}== |
|||
{{works with|jq}} |
|||
'''Works with gojq, the Go implementation of jq''' |
|||
The solution below assumes the input is in a file named input.txt, and is quite lenient about the presentation of the numbers. For example, it does not require that each pair of numbers be presented on the same line. |
|||
<lang sh> |
|||
< input.txt jq -n ' |
|||
input as $n |
|||
| if ($n | type != "number") or ($n < 1) |
|||
then "Number of pairs must be a positive integer." | error |
|||
else range(0; $n) |
|||
| [input,input] | add |
|||
end' |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
3 |
|||
30 |
|||
2 |
|||
102 |
|||
10 |
|||
</pre> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |