View Single Post
Old Dec 14th, 2006, 5:18 PM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
well, right now you are reseting the varible "a" to a new number everytime your loop runs.

you need to add the value to a, here's how i would do it.

Function product(ByVal n As Double, ByRef i As Double)
       Dim a As Double
       a = 0
       for i = 1 To n
              a = a + (i*n)
       Next
       Return a
End Function

not sure if that's what you are looking for. Also, this looks like homework....please don't let it be homework, mainly because posting homework questions is against the forum rules.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote