
-----------------------------------
zomg
Thu Nov 18, 2004 8:20 am

using an array to get an average
-----------------------------------
Hi this is a basic "finding an average of 5 numbers" program


var mark :int 
var sum :int :=0
put"Enter Marks."
for count :1..5
    put count
    get mark
    sum:=sum+mark
end for
put"Average is ", round (sum/5)


you can change how many numbers u want to average by


for count :1..6


or get the end user to input how many numbers he wants to average u do this:


var x : int
var mark :int 
var sum :int :=0
put"how many numbers would u like to average?"
get x
put"Enter Marks."
for count :1..x
    put count
    get mark
    sum:=sum+mark
end for
put"Average is ", round (sum/x)


[/quote]

-----------------------------------
Andy
Thu Nov 18, 2004 10:29 am


-----------------------------------
question.. do you enjoy posting code that everyone on the site noes how to write? plz only post useful codes that is at least semi difficult and requires and actually requires thinking and problem solving so others can learn from it

-----------------------------------
zomg
Thu Nov 18, 2004 12:03 pm


-----------------------------------
jeez i thought somebody might not kno how to do it, sorry :? 

o well whatever

and u might want to delete my other post thats exactl the same
im not shure how it happened but its called"find an average"
just thought i'd tell ya

-----------------------------------
Andy
Thu Nov 18, 2004 3:41 pm


-----------------------------------
nope cant.. dan wont give me powers in the turing sections.. hes afraid i'll scare too many ppl..
