Skip to content

Array question

Tina

Asked Jul 10, 2006, 3:20 PM EDT5 answers
Share
LinkedInX
I am new to C# and I have a problem.I want to get user input for some numbers(not fixed numbers) and find the average of the numbers entered.I figured that I could store the numbers in an array and then go from there.How do I do that?
Thanks.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0
    sounds like a homework problem :-)

    -Mike G.
    0
  • 0
    what does that mean?
    Anyway, I really need help with this.Please help
    0
  • 0
    An array is not really needed.
    Begin with a counter and accumulator.
    Use a loop to have user enter a number to add, or zero to stop.
    Add that number on to the accumulator (total).
    Increment the counter if the number entered is not a zero.
    Stop the loop when the number entered is a zero.
    Divide the total by the counter to get the average.
    0
  • 2 short replies
    • 0
      Thanks a lot.
      0