Averages/Arithmetic mean: Difference between revisions

Add Plain English
(adding lambdatalk)
(Add Plain English)
Line 2,627:
=={{header|PL/I}}==
<lang pli>arithmetic_mean = sum(A)/dimension(A,1);</lang>
 
=={{header|Plain English}}==
<lang plainenglish>To run:
Start up.
Demonstrate finding the arithmetic mean.
Wait for the escape key.
Shut down.
 
An entry is a thing with a fraction.
A list is some entries.
A sum is a fraction.
A mean is a fraction.
 
To demonstrate finding the arithmetic mean:
Create an example list.
Write "A list: " then the example list on the console.
Find a mean of the example list.
Write "The list's mean: " then the mean on the console.
Destroy the example list.
 
To add a fraction to a list:
Allocate memory for an entry.
Put the fraction into the entry's fraction.
Append the entry to the list.
 
To create an example list:
Add 1/1 to the example list.
Add 2/1 to the example list.
Add 5-1/3 to the example list.
Add 7-1/2 to the example list.
 
To find a sum of a list:
Put 0 into the sum.
Get an entry from the list.
Loop.
If the entry is nil, exit.
Add the entry's fraction to the sum.
Put the entry's next into the entry.
Repeat.
 
To find a mean of a list:
Find a sum of the list.
Put the sum divided by the list's count into the mean.
 
To convert a list to a string:
Get an entry from the list.
Loop.
If the entry is nil, break.
Append the entry's fraction to the string.
If the entry's next is not nil, append ", " to the string.
Put the entry's next into the entry.
Repeat.</lang>
{{out}}
<pre>
A list: 1, 2, 5-1/3, 7-1/2
The list's mean: 3-23/24
</pre>
 
=={{header|Pop11}}==
1,808

edits