We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
readcount_of_numberif[["$count_of_number"-ge1&&"$count_of_number"-le500]];thenlist_of_integers=0fornumberin$(seq1$count_of_number)doreadnumbersif[["$numbers"-ge-10000&&"$numbers"-le10000]];thenlist_of_integers=$(($numbers+$list_of_integers))elseecho"the number: $numbers is out of the range (-10000 <= x <= 10000)"exit1fidoneaverage=$(echo"scale=4; $list_of_integers / $count_of_number"|bc-l|xargsprintf"%.3f")echo$averageelseecho"the count of number is out of the range (1 <= N <= 500)"fi
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compute the Average
You are viewing a single comment's thread. Return to all comments →