76 289
Assignments Done
Successfully Done
In May 2019

Answer to Question #8307 in C++ for Eugine

Question #8307
an algorithm to find the average of the numbers in a linked list of numbers
Expert's answer

To find the average of numbers in a linked list you should calculate the total number of this numbers (N), calculate the sum of all this numbers (Sum). So the
expected value is Sum / N.

list l;

int sum = 0;

int n = 0;

while (l.next != 0) {

sum += l.number;


l = l.next;


return (float) sum / n;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions