algoritmos-para-estudar-Dou.../aula-3-resolvendo.html

30 lines
784 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<p>TESTE 3</p>
<p>
uma array contendo 40 numeros aleatórios, retornar somente os números
pares divisíveis por 5, faça isso em javascript.
</p>
<script>
let arr = [];
for(let i = 0; i < 40; i++) {
let numAleatorio = Math.floor(Math.random() * 100)
if(numAleatorio % 2 == 0 ) {
if(numAleatorio % 5 == 0) {
arr.push(numAleatorio)
}
}
}
console.log(arr)
</script>
</body>
</html>