Skip to content

Instantly share code, notes, and snippets.

@Eriner
Created January 23, 2016 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eriner/f2938b72f9329864e48e to your computer and use it in GitHub Desktop.
Save Eriner/f2938b72f9329864e48e to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
numbers=($(<${1}))
for n in {1..${#numbers}..2}; do
first=${numbers[n]}
second=${numbers[$(( n + 1 ))]}
sum=0
for i in {${first}..${second}}; do
sum=$(( ${sum} + i ))
done
print ${sum}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment