#!/bin/bash read n #echo "n: " $n i=0 sum=0 while [ $i -lt $n ] do read val # echo "val: " $val sum=`echo "scale=10; $sum+$val" | bc` i=`expr $i + 1` done printf '%.10f\n' $sum