
Resumo da Live TikTok 16/10/2024
Olá Pessoal!
Na Live do dia 16/10/2024 praticamos lógica de programação com JavaScript.
MAIOR E MENOR NÚMERO
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let numero = Number(prompt("Digite um número (ou um valor negativo para parar):"));
let maior = numero;
let menor = numero;
while (numero >= 0) {
numero = parseFloat(prompt("Digite outro número (ou um valor negativo para parar):"));
if (numero >= 0) {
if (numero > maior) {
maior = numero;
}
if (numero < menor) {
menor = numero;
}
}
}
console.log(`O maior número inserido foi: ${maior}`);
console.log(`O menor número inserido foi: ${menor}`);
</script>
</body>
</html>
CALCULAR ÁREA
function calcularTinta( altura, largura, rendimento){
//CALCULAR A AREA
const area = altura * largura;
const quantidadeTinta = area / rendimento;
return quantidadeTinta;
}
const alturaParede = 2.5;
const larguraParede = 3.0;
const rendimentoTinta = 10;
const totalTinta = calcularTinta(alturaParede, larguraParede, rendimentoTinta );
console.log("Total de tinta necessária: " + totalTinta.toFixed(2) + " litros ");
FATORIAL
function calcularFatorial(n){
let fatorial = 1;
for( let i = 1; i <= n; i++ ){
// fatorial = fatorial * i ;
fatorial *= i;
}
return fatorial;
}
let numero = 5
console.log(" O fatorial de " + numero + " é : " + calcularFatorial(numero) );
FATORIAL RECURSIVO
function fatorialRecursivo(n){
if( n === 0 || n === 1){
return 1;
}else{
return n * fatorialRecursivo(n - 1);
}
}
let numero = 5;
console.log(" O gatorial de " +
numero + " é: " + fatorialRecursivo(numero));
FIBONACCI
// 0 1 1 2 3 5 8 13 21
let n = 7;
let a = 0, b = 1, proximoNumero;
console.log(a);
console.log(b);
for(let i = 2; i < n; i ++ ){
proximoNumero = a + b;
console.log(proximoNumero);
a = b;
b = proximoNumero
}

https://go.hotmart.com/V89811082M?dp=1
https://go.hotmart.com/X90111663X?dp=1
HORÁRIO DAS LIVES
Domingo e Segunda às 19:00hs
Quarta às 18:00hs
Quinta e Sexta às 9:30hs
Sábado às 20:00hs

