Math Functions in VB

  • Thread starter Thread starter jigsaw117 via AccessMonster.com
  • Start date Start date
J

jigsaw117 via AccessMonster.com

Ok so im doing a project that i need to use a divisor function in but i can
not find the code anywhere

help would be much appreciated
 
Dave was asking you to explain what you mean by "a divisor function".

If you explain what you want, odds are someone can help you.
 
oooooo...i knew that...

um ok like

n is a variable

takes the divisors of n and adds them up.

so if n is 12, 1 + 2 + 3 + 4 + 6 + 12 = 28

then i would just assign an integer for the answer
Dave was asking you to explain what you mean by "a divisor function".

If you explain what you want, odds are someone can help you.
nope, ive already tried that
[quoted text clipped - 4 lines]
 
OK, this sure sounds like homework to me.

jigsaw117, wake up and think! Don't be so lazy (your words).

This took under a minute to write and test:

'----------------------
Public Function divisor(pNumber As Long) As Long
Dim i As Long
Dim tmp As Long

For i = pNumber To 1 Step -1
If pNumber Mod i = 0 Then
'Debug.Print i
tmp = tmp + i
End If
Next
divisor = tmp
End Function
'----------------------


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


jigsaw117 via AccessMonster.com said:
oooooo...i knew that...

um ok like

n is a variable

takes the divisors of n and adds them up.

so if n is 12, 1 + 2 + 3 + 4 + 6 + 12 = 28

then i would just assign an integer for the answer
Dave was asking you to explain what you mean by "a divisor function".

If you explain what you want, odds are someone can help you.
nope, ive already tried that
[quoted text clipped - 4 lines]
help would be much appreciated
 
Yeah, it's gotta be, like, um, totally homework, like, u know...?

LOL

Kids these days. How are they ever going to learn enough to hold a decent
job...?



Steve Sanford said:
OK, this sure sounds like homework to me.

jigsaw117, wake up and think! Don't be so lazy (your words).

This took under a minute to write and test:

'----------------------
Public Function divisor(pNumber As Long) As Long
Dim i As Long
Dim tmp As Long

For i = pNumber To 1 Step -1
If pNumber Mod i = 0 Then
'Debug.Print i
tmp = tmp + i
End If
Next
divisor = tmp
End Function
'----------------------


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


jigsaw117 via AccessMonster.com said:
oooooo...i knew that...

um ok like

n is a variable

takes the divisors of n and adds them up.

so if n is 12, 1 + 2 + 3 + 4 + 6 + 12 = 28

then i would just assign an integer for the answer
Dave was asking you to explain what you mean by "a divisor function".

If you explain what you want, odds are someone can help you.

nope, ive already tried that

[quoted text clipped - 4 lines]

help would be much appreciated
 
hey, i have a job. and its not homework we are doing practice programs for
this compatition in january and i was having a brain fart
Yeah, it's gotta be, like, um, totally homework, like, u know...?

LOL

Kids these days. How are they ever going to learn enough to hold a decent
job...?
OK, this sure sounds like homework to me.
[quoted text clipped - 38 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top