View Single Post
Old Dec 14th, 2006, 4:20 PM   #1
dwizzle13
Newbie
 
Join Date: Oct 2006
Posts: 19
Rep Power: 0 dwizzle13 is on a distinguished road
Question Help - Get the product of the numbers between 1 and n?

How can I change this code to get the product of the numbers between 1 and a variable n. Here's the code, and I can just get the n's square.

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

Thanks.
dwizzle13 is offline   Reply With Quote