From 6e0f92f9088012f6631f0ac0eac06ca4b84d47d7 Mon Sep 17 00:00:00 2001 From: ProgramadorAlien <110763299+ProgramadorAlien@users.noreply.github.com> Date: Sun, 16 Oct 2022 16:27:00 +0200 Subject: [PATCH 1/2] Add files via upload --- Solucion reto1 en swift.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Solucion reto1 en swift.txt diff --git a/Solucion reto1 en swift.txt b/Solucion reto1 en swift.txt new file mode 100644 index 0000000..83697c3 --- /dev/null +++ b/Solucion reto1 en swift.txt @@ -0,0 +1,4 @@ +func isAnagrama(wordOne: String, wordTwo: String) -> Bool{ +return wordOne.lowercased() == wordTwo.lowercased() ? false : wordOne.lowercased().sorted().elementsEqual(wordTwo.lowercased().sorted()) +} + print(isAnagrama(wordOne: "Amor", wordTwo: "roma")) \ No newline at end of file From 526dc34460843a67a3038713db55cfc6f0b34ce2 Mon Sep 17 00:00:00 2001 From: ProgramadorAlien <110763299+ProgramadorAlien@users.noreply.github.com> Date: Sun, 16 Oct 2022 19:53:02 +0200 Subject: [PATCH 2/2] Add files via upload --- "Soluci\303\263n Reto 41 en Swift.txt" | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "Soluci\303\263n Reto 41 en Swift.txt" diff --git "a/Soluci\303\263n Reto 41 en Swift.txt" "b/Soluci\303\263n Reto 41 en Swift.txt" new file mode 100644 index 0000000..ae1715a --- /dev/null +++ "b/Soluci\303\263n Reto 41 en Swift.txt" @@ -0,0 +1,21 @@ +import Foundation + +func ohm(v: Double, i: Double, r: Double){ + if(v == 0 && i == 0 && r == 0){ + print("Invalid values") + } + else if (v != 0 && i != 0 && r != 0){ + print("Invalid values") + } + else if(v == 0 && i != 0 && r != 0){ + print(String(format: "%.2f", i * r)) + } + else if(i == 0 && v != 0 && r != 0){ + print(String(format: "%.2f", v/r)) + } + else{ + print(String(format: "%.2f", v/i)) + } +} + +let num = ohm(v: 7, i: 8, r: 4.55) \ No newline at end of file