R
Raphael Gluck
Hi
I'm really new to programming and i'm reading through a book, teach yourself
asp.net by SAMS.
I'm having some difficulty with one of the vb.net lessons.
What i am supposed to be doing is create simple function to return the
factorial amount of the numbers 1 to 5.
Factorial is where you take a number and multiply it by all the digits that
exist below that number, e.g 3 would be 3 * 2 * 1 which would give you a
total of 6.
I've been really stuck with this for hours on end. It doesnt help that there
are several very annoying mistakes in the book, ( a bad worker blames his
tools)
So i just wanted to post the code here,
Please somone show me where i am wrong.
Function Factorial (n as integer) as integer
Dim i as integer
for i = 1 to 5
i = i * (i-1)
next i
Return Factorial
End function
Sub Page_load (sender as object, e as EventArgs)
response.write(factorial)
end sub
Please help me.
Raphael
I'm really new to programming and i'm reading through a book, teach yourself
asp.net by SAMS.
I'm having some difficulty with one of the vb.net lessons.
What i am supposed to be doing is create simple function to return the
factorial amount of the numbers 1 to 5.
Factorial is where you take a number and multiply it by all the digits that
exist below that number, e.g 3 would be 3 * 2 * 1 which would give you a
total of 6.
I've been really stuck with this for hours on end. It doesnt help that there
are several very annoying mistakes in the book, ( a bad worker blames his
tools)
So i just wanted to post the code here,
Please somone show me where i am wrong.
Function Factorial (n as integer) as integer
Dim i as integer
for i = 1 to 5
i = i * (i-1)
next i
Return Factorial
End function
Sub Page_load (sender as object, e as EventArgs)
response.write(factorial)
end sub
Please help me.
Raphael