-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercicio2.php
113 lines (86 loc) · 4.22 KB
/
exercicio2.php
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="pt-br">
<head>
<!-- Meta tags Obrigatórias -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<title>Exercicio 2 !</title>
</head>
<body>
<div class="container-fluid p-0">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="index.php">
<img src="images/Logo.png" width="30" height="30" class="d-inline-block align-top" alt="">
Exercicios
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Alterna navegação">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="index.php">Home <span class="sr-only">(Página atual)</span></a>
<a class="nav-item nav-link" href="exercicio1.php">Exercicio1</a>
<a class="nav-item nav-link" href="exercicio2.php">Exercicio2</a>
<a class="nav-item nav-link" href="exercicio3.php">Exercicio3</a>
<a class="nav-item nav-link" href="exercicio4.php">Exercicio4</a>
<a class="nav-item nav-link" href="exercicio5.php">Exercicio5</a>
<a class="nav-item nav-link" href="exercicio6.php">Exercicio6</a>
<a class="nav-item nav-link" href="exercicio7.php">Exercicio7</a>
<a class="nav-item nav-link" href="exercicio8.php">Exercicio8</a>
<a class="nav-item nav-link" href="exercicio9.php">Exercicio9</a>
</div>
</div>
</nav>
<!-- exercico 2-->
<div class="container center my-3">
<h1 class="display-4 text-muted pb-2">Exercicio 2</h1>
<form method="post">
<div class="form-group">
<div class="col-sm-5">
<input type="text" name="txNumero" class="form-control" placeholder="digite um numero em dias" />
</div>
<div class="form-group">
<div class="col-sm-5 mt-3">
<input type="submit" class="btn btn-primary" value="ver numeros :" />
</div>
</div>
</div>
</form>
<?php
$Num = isset($_POST["txNumero"])?$_POST["txNumero"]:"";
$Ano = 0;
$Dia = 0;
$Mes = 0;
while($Num>0){
if($Num>=365){
$Num = $Num - 365;
$Ano++;
}
else if($Num>=30){
$Num = $Num - 30;
$Mes++;
}
else if($Num>0){
$Num = $Num - 1;
$Dia++;
}
}
echo "Total de Anos : " . $Ano . "<br>";
echo "Total de Mes : " . $Mes . "<br>";
echo "Total de Dias : " . $Dia . "<br>";
?>
</div>
<!-- JavaScript (Opcional) -->
<!-- jQuery primeiro, depois Popper.js, depois Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<footer class="footer fixed-bottom py-3 bg-dark text-light text-center">
<p class="mb-0">© Direitos reservados, Breno , James e Vania </p>
</footer>
</div>
</body>
</html>