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

Challenges/06 numeros primos/javascript/mrnullus #454

Open
wants to merge 2 commits into
base: main
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
24 changes: 24 additions & 0 deletions challenges/6-numeros-primos/javascript/mrnullus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Submissão de Exercicio

**Exercicio:** 6 - Números Primos

**Nickname:** MrNullus

**Nível Técnico:**

**Empresa:**

**Twitter**: https://twitter.com/_MrNullus

**Dificuldade de Resolução:**

**Comentários:**

**Como rodar o desafio**:

Use o comando abaixo:
```bash
node app.js 12
node app.js 3
node app.js 1
```
6 changes: 6 additions & 0 deletions challenges/6-numeros-primos/javascript/mrnullus/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function main(input) {
console.log((input % 2 == 0 && input > 1)? "Número primo" : "Número não primo");
}


main(process.argv[2]);
24 changes: 24 additions & 0 deletions challenges/7-graus-em-horas/javascript/mrnullus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Submissão de Exercicio

**Exercicio:** 7 - Graus em Horas

**Nickname:** MrNullus

**Nível Técnico:**

**Empresa:**

**Twitter**: https://twitter.com/_MrNullus

**Dificuldade de Resolução:**

**Comentários:**

**Como rodar o desafio**:

Use o comando abaixo:
```bash
node app.js 180
node app.js 60
node app.js 200
```
37 changes: 37 additions & 0 deletions challenges/7-graus-em-horas/javascript/mrnullus/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function main(input) {
const SEGUNDOS_POR_MINUTO = 3600;
const graus = input;

let horas;
let minutos = 0;
let minutosCorrigidos;
let segundosDasHoras;
let segundosRestantes
let segundosFinal;

horas = graus / 30;

segundosDasHoras = horas * SEGUNDOS_POR_MINUTO;
segundosRestantes = segundosDasHoras;

if (!Number.isInteger(horas)) {
minutos = Math.trunc((segundosRestantes / 60) / 10);
}

segundosFinal = segundosRestantes % 60;

if (segundosRestantes < 60) {
segundosFinal = Math.trunc(segundosRestantes);
}

minutosCorrigidos = minutos % 60;

console.log(`
\n
| ${Math.trunc(horas)} | ${minutosCorrigidos} |
\n
`);
}


main(process.argv[2]);