Commit df1ce1d5 authored by Abhijeet Pratap's avatar Abhijeet Pratap

Upload new file

parent 94d60d9d
#!/bin/bash
file_name=$(<$*)
file_name=($(for each in ${file_name[@]}; do echo $each; done | sort))
count=0
sum=0
for values in "${file_name[@]}";
do
sum=$((sum+values))
count=$((count+1))
done
avg=$((sum/count))
echo $avg
remainder=$(($count%2))
mid=$((count/2))
if [ $remainder -eq 0 ]
then
echo ${file_name[$mid]}
else
median_sum=$(((${file_name[$mid]} + ${file_name[$((mid+1))]})/2))
echo $median
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment