Answers for "sum of array elements bash"

0

sum of array elements bash

read -a array
tot=0
for i in ${array[@]}; do
  let tot+=$i
done
echo "Total: $tot"
Posted by: Guest on November-26-2020

Code answers related to "sum of array elements bash"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language