Created
October 15, 2018 15:00
-
-
Save LOCOSP/e9f49c0af8f362e9e6efd941748d2296 to your computer and use it in GitHub Desktop.
Swift Playground function
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
import Foundation | |
var wartoscTowaru: Float = 13 | |
var rabat:Int = 10 | |
func obliczRabat ( wartoscTowaru : Float, wysokoscRabatu : Int ) -> String { | |
let wartoscRabatu: Float = wartoscTowaru * Float(rabat) / 100 | |
let formatWartoscRabatu = String(format: "%.2f", wartoscRabatu) | |
let kwotaPoRabacie = wartoscTowaru - wartoscRabatu | |
let formatKwotaPoRabacie = String(format: "%.2f", kwotaPoRabacie) | |
print("Wartość rabatu przy zniżce \(rabat)% wynosi: \(formatWartoscRabatu) PLN") | |
print("Kwota do zapłaty po rabacie: \(formatKwotaPoRabacie) PLN") | |
print (formatKwotaPoRabacie) | |
return formatKwotaPoRabacie | |
} | |
obliczRabat ( wartoscTowaru : wartoscTowaru, wysokoscRabatu : rabat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment