How do we do this =(

[LinkZ]'s Avatar, Join Date: Sep 2007
Newbie Member
Write a program that inserts 25 random integers from 0 to 100 in order in a linked list. The program should calculate the sum of the elements and the floating-point average of the elements.

The list is:
6 12 14 20 27 31 31 34 37 38 56 59 63 66 72 73 73 76 77 79 88 94 95 96 97

The sum is 1414
The average is 56.560000


Guys please help, i'm really lost on this one =(
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Actually, we don't accept assignments. We've been there and done that. You need to reason out how you would go about this task. Express the steps in your native language. When it looks good, translate it to code. Post back if/when you have troubles with the code. Be sure and read the "Before you make a query" thread before you post code or future questions.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I can give you the algo at the max.

Have the list in the array.
Loop through the list till you are done with all the elements.
Add each element and store them in some variables.
Now the result is in the variable and the average is variable by the number of times loop executed.