Created
October 2, 2020 04:44
-
-
Save SergeyTLV/592d0ef92a49aafd70c89db87dde3b89 to your computer and use it in GitHub Desktop.
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
func potatoes (_ p0: Int, _ w0: Int, _ p1: Int) -> Int { | |
let dryMatter = (Double(w0) / 100) * Double(100 - p0) | |
let finalPercentOfDryMatter = 100 - p1 | |
let w1:Int = Int(dryMatter) / (Int(finalPercentOfDryMatter) / 100) | |
return (Int(w1)) | |
} | |
/* | |
ERROR | |
solution.swift:8:5: warning: variable 'w1' was never mutated; consider changing to 'let' constant | |
var w1:Int = Int(dryMatter) / (Int(finalPercentOfDryMatter) / 100) | |
~~~ ^ | |
let | |
Fatal error: Division by zero | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment