You are viewing a single comment's thread. Return to all comments →
read n sum=0 for ((i=0; i<n; i++)) do read a; sum=$((sum+a)); done avg_num=$(echo "scale=3; $sum/$n" | bc ); echo $avg_num;
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 →