Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-09-2005, 09:51 AM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
even division anyone?

Problem:
take a number $num

$num = 32;

now continually divide $num / 2 until it reaches 1... ONLY return even values (no 5's for instance).. and DONT return duplicate entries

Anyone have a clue on how to do this?

^.^ I've tried several variations on the for loop and I still cant get it
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #2  
Old 06-09-2005, 09:53 AM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

now i'm not familar with for but shouldn't it be something like

for( when num = 1) {
$num / 2;
}

Sincerely,
Elite
Reply With Quote
  #3  
Old 06-09-2005, 10:03 AM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
that'll return every single number thats divisble by 2... ^.^;

// Side note, this is for PHP lol... incase anyone didnt get that

I only want the even NON repeated ones

$d = 32;
for($a = 2; $a <= ($d+ 2); $a+=2){
$var = round($d/$a, 0);
if($var != $var-2){
echo $var."<br>";
}
}

The ouput for that is:

16
8
5 // dont want that
4
3 // nor that
3 // nor that
2 // only once
2 // not 2x
2 // not 3x
2 // not 4x
1 // only once
1 // not the other 5 times
1
1
1
1
1
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #4  
Old 06-09-2005, 11:51 AM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
Got it ^.^
Well someone at programmingtalk.com got it for me

heres what ya do

while( $num != 1) {
$remainder = $num % 2;
if ($remainder == 1)
$num /= 2;
else {
$num /= 2;
echo $num."<br>";
}
}

Works beautifully
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #5  
Old 06-09-2005, 12:34 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

Nice! BTW why did you need it?
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #6  
Old 06-09-2005, 12:36 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
writing a tournament thing and i needed it to insert some fake entries ^.^ I'm still working on it.... it shoudl be out in a month or less
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
  #7  
Old 06-09-2005, 12:48 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

Cool! Keep us posted
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #8  
Old 06-09-2005, 05:48 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

yes certainly...as of i will be building one soon ... not terribly excited
Reply With Quote
  #9  
Old 06-09-2005, 08:31 PM
BeBop is offline BeBop
Registered User

Join Date: Jun 2002
Posts: 600

Send a message via ICQ to BeBop Send a message via AIM to BeBop Send a message via Yahoo to BeBop
Hey here, i put this together so you can check on the status of the script when you want

http://dev.bluescripts.net/bsTourney/index.php

user: dev
pass: ilovephp

It lists stuff thats on the TODO list and stuff thats on the DONE list

Regards,
Josh

PS: I'm not sure if this will be made free or for pay, im still tossing the idea up... but so far i've been working on it for a week and its goign to have A LOT of features ... Maybe make a "Lite" free version or something.

Let me know what you all think.

I've been working on it two days straight barely interruptions lol... reason being: My AA account wont let me login cuz my username has some hex characters in it... only allowed one user change every 24 hours x.x

PSS: -Elite-... making the brackets show up... PAIN IN THE ASS ^.^ just so you know it took me about a month to figure it out lol... on my own... i probably should've asked someone... one day it just popped into my head *Hey! Do it that way using that!* and bam... it worked ^.^
__________________
- My: Drawings, rants, raves, my cat, designs, and everything else i want to put on the net.
Free Teamspeak servers: http://gamersnetwork.us/

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Division A Voting Luckz Sigs and Graphics 21 08-16-2008 10:29 AM
First Elite Division Recruiting BARRACUDA Gaming Talk 1 08-25-2006 01:03 PM
Division X Wants You!!!! Tank-76- Gaming Talk 1 10-19-2004 03:12 PM
F.O.X Division Dks RiverRat Delta Force 0 10-17-2004 01:10 PM
Honorable Division looking to recruit 949thSgtRiddick Gaming Talk 0 07-17-2004 09:26 AM


All times are GMT -5. The time now is 04:48 PM.




Powered by vBulletin®