-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exerciciosFeitos #79
Open
raphhax
wants to merge
1
commit into
COLTEC-DAW:master
Choose a base branch
from
raphhax:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
exerciciosFeitos #79
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
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,16 @@ | ||
function fizzBuzz(){ | ||
const numMax = 100; | ||
for(i = 1; i <= numMax; i++){ | ||
if(i % 3 == 0 && i % 5 == 0){ | ||
console.log("FizzBuzz"); | ||
} else if(i % 5 == 0){ | ||
console.log("Buzz"); | ||
} else if(i % 3 == 0){ | ||
console.log("fizz"); | ||
} else{ | ||
console.log(i); | ||
} | ||
} | ||
} | ||
|
||
fizzBuzz(); |
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,11 @@ | ||
function palindromo(){ | ||
let palavra = prompt("Digite uma palavra para verificar se é palindromo: "); | ||
palavra = palavra.toLocaleLowerCase().replace(/\s/g, ''); | ||
let arvalap = palavra.split('').reverse().join(''); | ||
if(palavra === arvalap){ | ||
console.log("A palavra " + palavra + " é um palíndromo!"); | ||
} else{ | ||
console.log("A palavra " + palavra + " não né um palíndromo pos ao contrário fica: " + arvalap); | ||
} | ||
} | ||
palindromo(); |
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,12 @@ | ||
function triangulo() { | ||
let nLinhas = 5; | ||
for (i = 0; i < nLinhas; i++) { | ||
let linha = ""; | ||
for (j = 0; j <= i; j++) { | ||
linha = linha + "#"; | ||
} | ||
console.log(linha); | ||
} | ||
} | ||
|
||
triangulo(); |
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 @@ | ||
function xadrez(){ | ||
let quantLinhas = prompt("Digite a quantidade de linhas do xadrez: "); | ||
let horizontal = "# # # #"; | ||
|
||
for(i = 1; i <= quantLinhas; i++){ | ||
if(i % 2 == 0){ | ||
console.log(" " + horizontal); | ||
} else{ | ||
console.log(horizontal); | ||
} | ||
} | ||
} | ||
|
||
xadrez(); |
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,8 @@ | ||
function countChars(frase, c){ | ||
return frase.split(c).length - 1; | ||
} | ||
|
||
let frase = prompt("Frase: "); | ||
let c = prompt("Caractere a ser contado: "); | ||
|
||
console.log(countChars(frase, c)); |
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,21 @@ | ||
function min(a, b){ | ||
if(a < b){ | ||
console.log("O menor elemento é: " + a); | ||
} else{ | ||
console.log("O menor elemento é: " + b); | ||
} | ||
} | ||
|
||
function max(a, b){ | ||
if(a > b){ | ||
console.log("O maior elemento é: " + a); | ||
} else{ | ||
console.log("O maior elemento é: " + b); | ||
} | ||
} | ||
|
||
let a = prompt("Digite o num1: "); | ||
let b = prompt("Digite o num2: "); | ||
|
||
min(a, b); | ||
max(a, b); |
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,25 @@ | ||
function mod2(number){ | ||
if (number % 2 === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
function mod(num, mod){ | ||
if (num % mod === 0) { | ||
return true; | ||
}else { | ||
return false; | ||
} | ||
} | ||
|
||
console.log(mod2(1)); | ||
console.log(mod2(2)); | ||
console.log(mod2(3)); | ||
console.log(mod2(4)); | ||
|
||
console.log(mod(1, 0)); | ||
console.log(mod(1, 2)); | ||
console.log(mod(10, 5)); | ||
console.log(mod(10, 8)); |
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 @@ | ||
function deepEquals(obj1, obj2) { | ||
if (typeof obj1 === "object" && typeof obj2 === "object") { | ||
if (obj1 === null && obj2 === null) | ||
return true; | ||
|
||
if (obj1 === null || obj2 === null) | ||
return false; | ||
|
||
if (Object.keys(obj1).length !== Object.keys(obj2).length) | ||
return false; | ||
|
||
for (let prop in obj1) { | ||
if (!deepEquals(obj1[prop], obj2[prop])) | ||
return false; | ||
} | ||
return true; | ||
} | ||
return obj1 === obj2; | ||
} | ||
|
||
let obj1 = { | ||
nome: "Raphael", | ||
idade: 30, | ||
}; | ||
|
||
let obj2 = { | ||
nome: "Raphael", | ||
idade: 30, | ||
}; | ||
|
||
console.log(deepEquals(obj1, obj2)) |
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,8 @@ | ||
function range(min, max) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Faltou o intervalo |
||
let array = []; | ||
for (i = min; i <= max; i++) { | ||
array.push(i); | ||
} | ||
return array | ||
} | ||
console.log(range(1, 20)); |
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,10 @@ | ||
function reverseArray(array){ | ||
let reversed = []; | ||
for(let i = 0; i < array.length; i++){ | ||
reversed.push(parseInt(array[array.length - (i + 1)])); | ||
} | ||
return reversed; | ||
} | ||
|
||
let seq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | ||
console.log(reverseArray(seq)); |
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,12 @@ | ||
function reverseArray(array){ | ||
let reversed = []; | ||
|
||
for(let i = 0; i < array.length; i++){ | ||
reversed.push(parseInt(array[array.length - (i + 1)])); | ||
} | ||
|
||
return reversed; | ||
} | ||
|
||
let array = [1, 2, 3, 4, 5]; | ||
console.log(reverseArray(array)); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deveria ser recursivo