#!/bin/bash read n sum=0 temp=0 for (( i=0;i<n;i++ )) do read temp sum=$(( sum+temp )); done #echo $sum echo $( echo "scale=3; $sum/$n" | bc )