Skip to content

Commit

Permalink
Merge pull request #2 from mouredev/main
Browse files Browse the repository at this point in the history
Resolución Reto #3 y enunciado Reto #4
  • Loading branch information
Oscar-brv authored Jan 26, 2022
2 parents 87e1613 + 5f18d92 commit 4290efc
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Existen repositorios de código tanto para Kotlin/Android como para Swift/iOS en
* **#1** - 03/01/22 - `¿ES UN ANAGRAMA?`
* **#2** - 10/01/22 - `LA SUCESIÓN DE FIBONACCI`
* **#3** - 17/01/22 - `¿ES UN NÚMERO PRIMO?`
* **#4** - 24/01/22 - `Publicación nuevo reto...`
* **#4** - 24/01/22 - `ÁREA DE UN POLÍGONO`
* **#5** - 31/01/22 - `Publicación nuevo reto...`

### ¿Cómo puedo participar?

Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/mouredev/weeklychallenge2022/Challenge3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,27 @@ package com.mouredev.weeklychallenge2022

fun main() {

(1..100).forEach { number ->
if (isPrime(number)) {
println(number)
}
}
}

private fun isPrime(number: Int): Boolean {

if (number < 2) {
return false
}

for (i in 2 until number) {
if (number % i == 0) {
return false
}
}

return true
}



22 changes: 22 additions & 0 deletions app/src/main/java/com/mouredev/weeklychallenge2022/Challenge4.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mouredev.weeklychallenge2022

/*
* Reto #4
* ÁREA DE UN POLÍGONO
* Fecha publicación enunciado: 24/01/22
* Fecha publicación resolución: 31/01/22
* Dificultad: FÁCIL
*
* Enunciado: Crea UNA ÚNICA FUNCIÓN (importante que sólo sea una) que sea capaz de calcular y retornar el área de un polígono.
* - La función recibirá por parámetro sólo UN polígono a la vez.
* - Los polígonos soportados serán Triángulo, Cuadrado y Rectángulo.
* - Imprime el cálculo del área de un polígono de cada tipo.
*
* Información adicional:
* - Usa el canal de nuestro discord (https://mouredev.com/discord) "🔁reto-semanal" para preguntas, dudas o prestar ayuda la acomunidad.
* - Puedes hacer un Fork del repo y una Pull Request al repo original para que veamos tu solución aportada.
* - Revisaré el ejercicio en directo desde Twitch el lunes siguiente al de su publicación.
* - Subiré una posible solución al ejercicio el lunes siguiente al de su publicación.
*
*/

0 comments on commit 4290efc

Please sign in to comment.