fork download
  1.  
  2. read a
  3. b=$n
  4. sum=0
  5. c=1
  6. while [ $c -le $b ]
  7. do
  8. read a
  9. x=$a
  10. c=$(($c + 1))
  11. sum=$(($sum + $x))
  12. done
  13. result=`echo $sum $b | awk '{printf "%.3f", $1/$2 }'`
  14. echo $result
Success #stdin #stdout #stderr 0s 23336KB
stdin
4
1
2
9
8
stdout

	
stderr
./prog.sh: line 6: [: 1: unary operator expected
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted