+ 2

Popsicles help

Help, I don't know what to do here. It keeps giving me errors. var popsicles = Int(readLine()!) var siblings = Int(readLine()!) if popsicles % siblings == 0 { print("give away") } else { print("eat them yourself") } How do I make an int user input?

27th Apr 2020, 11:07 AM
Ārtēmī§
Ārtēmī§ - avatar
3 Answers
+ 6
You need to declare both variables as follows: var siblings:Int var popsicles:Int Further you need to add exclamation mark at end of these two statements. siblings = Int(readLine()!)! popsicles = Int(readLine()!)!
27th Apr 2020, 11:17 AM
...
+ 2
Ārtēmī§ you are welcome
27th Apr 2020, 11:18 AM
...
+ 1
Thanks Swapnil
27th Apr 2020, 11:18 AM
Ārtēmī§
Ārtēmī§ - avatar