You are viewing a single comment's thread. Return to all comments →
read N sum=0 for((i=1; i<=N; i++)) do read X sum=$((sum+X)) done expression="$sum / $N" result=$(printf %.3f $(echo $expression|bc -l)) echo $result
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Compute the Average
You are viewing a single comment's thread. Return to all comments →