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
10 changed files
with
49 additions
and
10 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
File renamed without changes.
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 @@ | ||
// 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; | ||
|
||
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); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,26 @@ | ||
// Faça um algoritmo que leia 6 valores positivos. Calcule a quantidade de números pares e ímpares, a média de valores pares e a média geral dos números lidos.array | ||
|
||
let numeros = [6, 1, 9, 8, 25, 7] | ||
let resto = 0; | ||
let totalPar = 0; | ||
let totalImpar = 0; | ||
let mediaPares = 0; | ||
let somaPares = 0; | ||
let somaImpar = 0; | ||
let mediaPar = 0; | ||
let mediaGeral = 0; | ||
|
||
|
||
for (let index = 0; index < numeros.length; index++) { | ||
resto = numeros[index] % 2; | ||
if (resto == 0) { | ||
totalPar++; | ||
somaPares = somaPares + numeros[index]; | ||
} else { | ||
totalImpar++; | ||
somaImpar = somaImpar + numeros[index]; | ||
} | ||
} | ||
mediaPar = somaPares / totalPar; | ||
mediaGeral = (somaPares + somaImpar) / numeros.length | ||
console.log(mediaGeral); |
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