Advertisement
vadim_sharaf

Untitled

Mar 5th, 2023
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.95 KB | None | 0 0
  1. //1 задание
  2. let daysToBirthday = 31+28+31+30+31+30+18
  3. let secondsToBirthday = 60*60*24*daysToBirthday
  4. print(secondsToBirthday)
  5.  
  6. //2 задание
  7. let mouthsToBirthday = 7
  8. let daysIn1Quarter = 31+28+31
  9. let daysIn2Quarter = daysIn1Quarter + 30 + 31 + 30
  10. let daysIn3Quarter = daysIn2Quarter + 31 + 31 + 30
  11. let daysIn4Quarter = daysIn3Quarter + 31 + 30 + 31
  12. if daysToBirthday <= daysIn1Quarter {
  13.     print("I was born in the first quarter")
  14. } else if daysToBirthday <= daysIn2Quarter {
  15.     print("I was born in the second quarter")
  16. } else if daysToBirthday <= daysIn3Quarter {
  17.     print("I was born in the third quarter")
  18. } else {
  19.     print("I was born in the fourth quarter")
  20. }
  21. let myQurter = mouthsToBirthday/3 + 1
  22. print("I was born in the \(myQurter) quarter")
  23.  
  24. //4 задание
  25. let posistion = (x: 3, y: 7)
  26. if (posistion.x + posistion.y) % 2 == 0 {
  27.     print("You are on the black cage")
  28. } else {
  29.     print("You are on the white cage")
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement