forked from dayanec/git-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex413.php
More file actions
34 lines (33 loc) · 857 Bytes
/
ex413.php
File metadata and controls
34 lines (33 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE HTML>
<Html>
<HEAD>
<TITLE>
Exercício 4.1.3 - Fibonacci
</TITLE>
<META charset="UTF-8">
</HEAD>
<Body>
<?php
$n = 0;
$n2 = 1;
$prox = 0;
$sequencia = 25;
$i;
echo "Exibindo sequência de Fibonacci com $sequencia elementos <br>";
for($i = 1;$i < $sequencia;$i++){
echo "$prox , ";
if($i < 2){
$prox = $n2 + $n;
}
else{
$prox = $n2 + $n;
$n = $n2;
$n2 = $prox;
}
if($i == $sequencia - 1){
echo "$prox";
}
}
?>
</Body>
</Html>