Answers for "How to find sum of elements in array in bash script"

0

How to find sum of elements in array in bash script

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 "How to find sum of elements in array in bash script"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language