Skip to content
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

Exercícios - Semana 3 - Glória Teodoro #29

Open
wants to merge 5 commits into
base: gloria-teodoro
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions entrega/Exercício01.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let habitantesA = 80.000
let habitantesB = 200.000
let anos = 0
while (habitantesA < habitantesB){
habitantesA = habitantesA*1.03
habitantesB = habitantesB*1.015
anos++
console.log("O número de anos é " + anos)
}
8 changes: 8 additions & 0 deletions entrega/Exercício02.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const readlineSync = require("readline-sync");
const palavra = readlineSync.question("Digite uma palavra que a mostrarei pelo avesso hehehe: ")
let posiçãoFinal = (palavra.length)
while(posiçãoFinal-1 >= 0){
console.log(palavra[posiçãoFinal-1])
posiçãoFinal--
}
//gostaria de saber como imprimir esse texto na tela de forma horizontal
13 changes: 13 additions & 0 deletions entrega/Exercício03.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const readlineSync = require("readline-sync");
function calculaFibonacci(n) {
if (n <= 2) return n;
return calculaFibonacci(n - 1) + calculaFibonacci(n - 2);
}
function mostraFibonacci() {
let numero = readlineSync.question("Digite um número inteiro: ");
let resultado = calculaFibonacci(parseInt(numero));

console.log("O Fibonacci de " + numero + " equivale a " + resultado);
}

mostraFibonacci();
11 changes: 11 additions & 0 deletions entrega/Exercício04.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const readlineSync = require("readline-sync");
function calculo(n1, n2, n3) {
return (n1 * n2 * n3) + 2
}
let n1 = parseFloat(readlineSync.question("Digite um número: "))
let n2 = parseFloat(readlineSync.question("Digite outro número: "))
let n3 = parseFloat(readlineSync.question("Agora mais um número: "))
console.log(calculo(n1, n2, n3))

/*não sei como fazer o programa retornar outra coisa além de "NaN", quando algum
dos campos não for digitado corretamente*/
3 changes: 3 additions & 0 deletions entrega/Exercício05.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for (let index = 1; index <= 50; index++){
console.log(index + '- ' + 1.99*index)
}