Re: Compution of Fibonacci

From: Date: Tue, 31 Jul 2001 06:59:07 +0000
Subject: Re: Compution of Fibonacci
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60321@lists.php.net to get a copy of this message
hi well first of all you have to remove the colon -- ";" sign from the end of your while loop ...... that will solve the problem for the time out. then there is problem with your code, this code will never get you the fibonacci since the variable a,b and c never go abone 0, see. :). On Tue, 31 Jul 2001, marke wrote: > hi! > i want to write a php script for Compution of Fibonacci(it is a integer > equal the sum of 2 numbers befor it).but there's a error:"Fatal error: > Maximum execution time of 30 seconds exceeded in C:\phpscr\Fibonacci.php > on line 6".i don't know why it happens.it looks like the loop can't be > finished. > > my code: > -------------------- > <? > $i=0; > $a=0; > $b=0; > $c=0; > while ($i < 17); > { > print "<table>"; > print "<tr><td>$i</td>"; > $a=$c+$b; > print "<td>$a</td></tr>"; > $b=$a; > $c=$b; > $i++; > } > ?> > ---------------------- > Thanks. > -- ,,,,, /'^ ^'\ -((o)-(o))- --oOOO--(_)--OOOo------- Saquib Farooq Malik saquib@isb.sdnpk.org saquibfarooq@yahoo.com Sustainable Develpment Network Program (SDNP) Tel: 2270684 .oooO ( ) Oooo. ---\ (-------( )------ \_) ) / (_/

« previous php.general (#60321) next »