Turbo pascal | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Turbo pascal

Turbo pascal Given a linear array of n-elements Determine the mean among the positive elements of an array

23rd Dec 2020, 6:57 AM
Sergei
1 Answer
+ 2
Sergei , use a loop to iterate over the array, and use a conditional expression to build the sum of only positive values, as well as to count the number of positive values. Than divide the sum by the number of positive elements. Happy coding!
23rd Dec 2020, 8:37 AM
Lothar
Lothar - avatar