Determining if X is a factor of Y

# Thread: Determining if X is a factor of Y

1. Senior Member
Join Date
Dec 1969
Posts
1,843

## Determining if X is a factor of Y

Hello, <BR><BR>I&#039;m sure this has been asked and answered, but my search for "Factor" gives me hundreds of results. <BR><BR>I need to repeate a certain string every 30 cycles of a loop. So, I need to find out if 30 is a factor of the current cycle. <BR><BR>As far as I know there isn&#039;t a built in function to do this, so if any of you have one that&#039;s pre-written, please share!! otherwise, I&#039;ll write my own..<BR><BR>Shane<BR>

2. Senior Member
Join Date
Dec 1969
Posts
2,334

## RE:asp question?

Is it a ASP question?

3. Junior Member
Join Date
Dec 1969
Posts
7

## RE: Determining if X is a factor of Y

Hi Shane,<BR><BR> I&#039;m not sure why you need to determine any factoring, so if the following doesn&#039;t help, please post some more info. Here&#039;s what I&#039;ve done in cases like you describe:<BR><BR>DO WHILE NOT RS.EOF<BR>IF Counter = 30 Then<BR> Response.Write("Your String goes here")<BR> Counter = 0<BR>END IF<BR>RS.MoveNext<BR>Counter = Counter + 1<BR>LOOP<BR><BR>I hope this helps.<BR><BR> --afpjr

4. Senior Member
Join Date
Dec 1969
Posts
1,843

## RE: Determining if X is a factor of Y

Different approach, same outcome, much simpler. <BR><BR>Excellent. <BR><BR>Thanks for the help. <BR><BR>Shane

5. Senior Member
Join Date
Dec 1969
Posts
1,032

## use the mod operator .....

for example 30 mod 30 = 0 , 60 mod 30 =0 , 90 mod 30 = 0<BR><BR>so in your loop , when [value] mod 30 =0 , you are a point in the loop at which 30 is a factor :-<BR><BR><BR>a=1<BR>do while a&#060;=120<BR>response.Write "When A="&a&" A mod 30 is "&a mod 30 &"&#060;br &#062;"<BR>a=a+1<BR>loop<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•