forked from MateusAugustoFerreira/exercicio-js-turma-tarde
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
115 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Em uma loja e CD ́s existem apenas quatro tipos de preços que estão associados a cores. Assim os CD ́s que ficam na loja não são marcados por preços e sim por cores. | ||
// Desenvolva o algoritmo que a partir a entrada da cor o software e mostre o preço. A loja está atualmente com a seguinte tabela de preços. | ||
|
||
// COR VALOR EXEMPLO | ||
// VERDE R$ 10 | ||
// AMARELO R$ 12 | ||
// VERMELHO R$ 15 | ||
// AZUL R$ 25 | ||
|
||
let cor = "azul"; | ||
|
||
switch (cor) { | ||
case 'verde': | ||
console.log("o valor será $10."); | ||
break; | ||
|
||
case 'amarelo': | ||
console.log("o valor será $12."); | ||
break; | ||
|
||
case 'vermelho': | ||
console.log("o valor será $15."); | ||
break; | ||
|
||
case 'azul': | ||
console.log("o valor será $25."); | ||
break; | ||
|
||
default: | ||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
// Desenvolver um algoritmo que efetue a soma de todos os números ímpares que são múltiplos de três e que se encontram no conjunto dos números de 1 até 500. | ||
|
||
let somaImpar = 0; | ||
let resto = 0; | ||
let n = 0; | ||
let soma = 0; | ||
let numeros = 0; | ||
for (numeros = 1; numeros <= 500 | ||
; numeros++) { | ||
if ((numeros % 2 !== 0) && (numeros % 3 == 0)) { | ||
soma += numeros; | ||
} | ||
} | ||
console.log(soma); | ||
|
||
for (let n = 1 ; n < 500 ; n++) | ||
resto = n[n] % 2; | ||
if (resto == 0) { | ||
|
||
} else ( n % 3 == 0) ; { | ||
somaImpar = somaImpar + n [n] ; | ||
} | ||
|
||
console.log(somaImpar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Escrever um script que leia número de 0 a 999. Desses, fazer a soma apenas dos ímpares e mostrar na tela. Mostrar também o total de números ímpares e pares. E por fim, fazer a média aritmética da soma dos números divisíveis por 3; | ||
|
||
|
||
|
||
// let resultado | ||
// let somaImpar = 0; | ||
// let totalImpar = 0; | ||
// let totalPar = 0; | ||
// let divisivel3 = 0; | ||
|
||
// for (let n = 0; n < 999; n++) { | ||
// resultado = n % 2 | ||
// if (resultado == 0) { | ||
// n++ | ||
// } else | ||
// console.log(n); | ||
|
||
|
||
let soma = 0; | ||
let numeros = 0; | ||
let totalPar = 0; | ||
let totalImpar = 0; | ||
let divisivel3 = 0; | ||
|
||
for (numeros = 1; numeros <= 999; numeros++) { | ||
if ((numeros % 3 == 0)) { | ||
divisivel3++ | ||
} if ((numeros % 2 == 0)) { | ||
totalPar++ | ||
} if ((numeros % 2 !== 0)) { | ||
totalImpar++ | ||
} | ||
} | ||
console.log(divisivel3); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let n = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; | ||
|
||
function maiorNumero(a, b) { | ||
if (a > b) { | ||
return 1 | ||
} else if (a < b) { | ||
return -1 | ||
} else { | ||
return 0 | ||
} | ||
} | ||
|
||
n.sort(maiorNumero); | ||
|
||
console.log(n[n.lenght-1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Escreva um script que leia 15 números positivos, encontre o maior deles e o menor deles, e mostre na tela. [array] | ||
|
||
// let numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | ||
|
||
// fazer outro exercicio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let n = [1,2,4,6,8,5,33,4,6,8] | ||
|
||
function teste(a, b){ | ||
if(a>b){ | ||
return 1 | ||
}else if(a<b){ | ||
return -1 | ||
} else{ | ||
0 | ||
} | ||
} | ||
|
||
n.sort(teste); | ||
console.log(n.lenght); |