php - Write a program using while loop to calculate and print the first ‘N’ Ex=10 Fibonacci number starts with (1,1),2, 3,5,8,13,21,34,55 Email ThisBlogThis!Share to TwitterShare to Facebook Reactions: Labs 5 Comments
$num1=$_POST["num"];
ReplyDelete$i=2;
$first=1;
$second=1;
echo "$first $second";
while($i!=$num1)
{
$third=$first+$second;
$first=$second;
$second=$third;
echo " $third";
$i++;
}
php
ReplyDelete$n=$_POST['num'];
$count=$n;
$first=1;
$second=1;
$i=2;
echo" the number of digit is:$count";
echo"$first\t$second";
while($i<$n)
{$next=$first+$second;
$first=$second;
$second=$next;
echo"
$next\t";
$i++;
}
?>
This comment has been removed by the author.
ReplyDelete$num=$_POST["n"];
ReplyDelete$i=2;
$n1=1;
$n2=1;
echo "$n1 $n2";
while($i!=$num)
{
$n3=$n1+$n2;
$n1=$n2;
$n2=$n3;
echo " $n3";
$i++;
}
?php
ReplyDelete$nos=$_POST["num"];
$first=0;
$second=1;
$third=0;
$i=1;
echo"$first, "." $second, ";
while($i<=$nos)
{
$third=$first+$second;
$i++;
$first=$second;
$second=$third;
echo"$third,";
}
?>