Hackerrank fibonacci lite

by admin on September 15th, 2016

Problem Url: Click Here

This is the solution code related to a problem i found at hackerrank.

$count = 0 ;
$total = 0;
$f1 = 1;
$f2 = 0;
while ($count < $number )
{
$f3 = $f2 + $f1 ;
$total = $f3;
$f1 = $f2 ;
$f2 = $f3 ;
$count = $count + 1;
}
echo $total;

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>