Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1 задание
- var const1 = "ufb4"
- var const2 = "48"
- var const3 = "h4"
- var const4 = "42"
- var const5 = "0384"
- let num1 = Int(const1) ?? 0
- let num2 = Int(const2) ?? 0
- let num3 = Int(const3) ?? 0
- let num4 = Int(const4) ?? 0
- let num5 = Int(const5) ?? 0
- let sum = num1 + num2 + num3 + num4 + num5
- let c1 = Int(const1) != nil ? String(Int(const1)!) : "nil"
- let c2 = Int(const2) != nil ? String(Int(const2)!) : "nil"
- let c3 = Int(const3) != nil ? String(Int(const3)!) : "nil"
- let c4 = Int(const4) != nil ? String(Int(const4)!) : "nil"
- let c5 = Int(const5) != nil ? String(Int(const5)!) : "nil"
- print("\(c1) + \(c2) + \(c3) + \(c4) + \(c5) = \(sum)")
- let plus = " + "
- let equal = " = "
- print(c1 + plus + c2 + plus + c3 + plus + c4 + plus + c5 + equal + String(sum))
- //2 задание
- let kiss = "\u{1F48F}"
- let dragons = "\u{1F409}"
- let deer = "\u{1F98C}"
- let flamingo = "\u{1F9A9}"
- let beaty = "\u{1F3DE}"
- print(deer.count)
- //3 задание
- var i = 0
- let alphabet = "qwertyuiopasdfghjklzxcvbnm"
- let word : Character = "f"
- var index = Int()
- for s in alphabet {
- if s == word {
- index = i
- }
- i += 1
- }
- print("Index of \(word) in QWERTY = \(index)")
Advertisement
Add Comment
Please, Sign In to add comment