jeudi 15 octobre 2020

calculating percentages in Swift [duplicate]

I am trying to calculate the below using Swift but cant work out how to do so.

var Value = 35000

up to 10000 of this Value is worked out at 10%

the value between 10000 & 30000 is calculated at 20%

Any thing above 30000 is calculated at 30%

All of the above calculations are added together.

I am using a variable for the value then trying to use a if else statement to calculate but cant get my head around it(still fairly new to dev)

Any ideas would be much appreciated.

Thanks

Aucun commentaire:

Enregistrer un commentaire