|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
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/ |
#2
|
||
|
now i'm not familar with for but shouldn't it be something like
for( when num = 1) { $num / 2; } Sincerely, Elite |
#3
|
||
|
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/ |
#4
|
||
|
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/ |
#5
|
||
|
Nice! BTW why did you need it?
|
#6
|
||
|
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/ |
#7
|
||
|
Cool! Keep us posted
|
#8
|
||
|
yes certainly...as of i will be building one soon ... not terribly excited
|
#9
|
||
|
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/ |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
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 |