Skip to content

Commit 728bc5b

Browse files
committed
Solution is added for Compute the Avarage.
1 parent ca4e673 commit 728bc5b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# Compute the Average
4+
# https://www.hackerrank.com/challenges/bash-tutorials---compute-the-average/problem
5+
6+
read number_of_input
7+
sum=0
8+
9+
for ((i=1; i<=$number_of_input; i++));
10+
do
11+
read number
12+
sum=$(($sum+$number))
13+
done
14+
15+
printf "%.3f" $(echo $sum/$number_of_input | bc -l)

0 commit comments

Comments
 (0)