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.
- Prepare
- Linux Shell
- Bash
- Compute the Average
- Discussions
Compute the Average
Compute the Average
Sort by
recency
|
348 Discussions
|
Please Login in order to post a comment
you came to this section because you know your code is working fine in your local terminal--
well, you're probably not getting it right because the output format is strict
There's one thing I don't understand: some of the test cases are failing and there's a note there saying "Hidden test cases are used to evaluate if your code can handle different scenarios, including corner cases." Does that mean the input may break the explicitly stated constraints and I should check it anyway? What should I do when the checks fail then? The assignment would be either wrong or unclear in such case.
Note that I can't see the the output of those failed test cases so I don't really know what's wrong - however, one of the failed inputs seem to have an extra new line et the end.
if [ "N" -gt 500 ]; then echo "N must be between 1 and 500" exit 1 fi
sum=0
for (( i=0; ix" -gt 10000 ]; then echo "Each integer must be between -10000 and 10000" exit 1 fi sum=$((sum + x)) done
Hello, In all the solutions describe here, It allways start with read n or read N
what i dont understand is why the variable n or N register the number of value entered (so we can devide by N at the end) and not the value itself ?
hope my english is correct and my question understandable ... thanks