Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   How do we do this =( (http://www.go4expert.com/forums/how-do-we-do-this-t6380/)

[LinkZ] 16Sep2007 20:32

How do we do this =(
 
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 16Sep2007 23:26

Re: How do we do this =(
 
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 17Sep2007 09:12

Re: How do we do this =(
 
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.


All times are GMT +5.5. The time now is 07:39.