forked from dayanec/git-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercicio4-2.php
More file actions
78 lines (76 loc) · 2.09 KB
/
exercicio4-2.php
File metadata and controls
78 lines (76 loc) · 2.09 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
table,tr,td{border:solid 1px;}
#tr2{background-color: gray;}
</style>
</head>
<body>
<table>
<?php
echo'<tr>
<td>ID</td>
<td>NOME</td>
<td>DESC</td>
</tr>';
$k = 1;
for( $i=0; $i<7;$i++){
if(($i%2==0)||($i==0)){
echo '<tr>
<td>id</td>
<td>nome</td>
<td>desc</td>
</tr>';
}else{
echo '<tr id="tr2">
<td>id</td>
<td>nome</td>
<td>desc</td>
</tr>';
}
}
?>
</table>
<p><?php
$n = 1193;
$cont = 0;
for($j=1;$j<=$n;$j++){
if($n%$j==0){
$cont++;
}
}
if($cont==2){
echo "<p>Número: $n é primo.</p>";
}else{
echo "<p>Número: $n não é primo.<p>";
}
?>
</p>
<p>
<?php
$n = 10;
$a = 0;
$b = 1;
echo "$n números da sequência de Fibonacci :{";
echo"$a,$b,";
for($i=0;$i<$n;$i++){
$soma = $a +$b;
echo "$soma";
if($i!=$n-1){
echo ',';
}
$a = $b;
$b = $soma;
}echo '}';
?>
</p>
</body>
</html>