How do we do this =(

Newbie Member
16Sep2007,20:32   #1
[LinkZ]'s Avatar
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 =(
Team Leader
16Sep2007,23:26   #2
DaWei's Avatar
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.
Go4Expert Founder
17Sep2007,09:12   #3
shabbir's Avatar
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.