How to resolve the algorithm Averages/Arithmetic mean step by step in the 11l programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Averages/Arithmetic mean step by step in the 11l programming language
Table of Contents
Problem Statement
Write a program to find the mean (arithmetic average) of a numeric vector. In case of a zero-length input, since the mean of an empty set of numbers is ill-defined, the program may choose to behave in any way it deems appropriate, though if the programming language has an established convention for conveying math errors or undefined values, it's preferable to follow it.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Averages/Arithmetic mean step by step in the 11l programming language
Source code in the 11l programming language
F average(x)
R sum(x) / Float(x.len)
print(average([0, 0, 3, 1, 4, 1, 5, 9, 0, 0]))
You may also check:How to resolve the algorithm Loops/Infinite step by step in the Jsish programming language
You may also check:How to resolve the algorithm Babbage problem step by step in the Prolog programming language
You may also check:How to resolve the algorithm Split a character string based on change of character step by step in the Forth programming language
You may also check:How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the BASIC programming language
You may also check:How to resolve the algorithm Read a file line by line step by step in the Objeck programming language