You are viewing a single comment's thread. Return to all comments →
You can also do it with a for loop and skip some of the EOL/EOF checking
sum=0 read n for i in `seq 1 $n`; do read -r line sum=`$(($`sum + $line)) done printf "%.3f" `$(echo "scale=10; $`sum/$n" | bc -l)
Seems like cookies are disabled on this browser, please enable them to open this website
Compute the Average
You are viewing a single comment's thread. Return to all comments →
You can also do it with a for loop and skip some of the EOL/EOF checking