250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- 자바스크립트
- Animation
- keyframes
- xcode
- iOS 개발자
- effect
- ipad
- MAC
- IOS
- html5
- react
- 애니메이션
- HTML
- 비전공 개발자
- CSS
- 풀스택
- javascript
- css3
- jQuery
- image
- 프론트엔드
- 비전공자
- front-end
- php
- 백엔드
- 개발자
- SWIFT
- button
- hover
- iPhone
Archives
- Today
- Total
비전공자 개발일기
[SWIFT] Coding Test Practice Day 1 본문
728x90
SMALL
https://school.programmers.co.kr/
두수의 합
import UIKit
func solution(_ num1:Int, _ num2:Int) -> Int {
guard (num1 >= -50000 && num1 <= 50000), (num2 >= -50000 && num2 <= 50000) else {
return -110000
}
let res = num1 + num2
return res
}
solution(2, 3)
solution(100, 2)
두수의 차
import UIKit
func solution(_ num1:Int, _ num2:Int) -> Int {
guard (num1 >= -50000 && num1 <= 50000), (num2 >= -50000 && num2 <= 50000) else {
return -110000
}
let res = num1 - num2
return res
}
solution(2, 3)
solution(100, 2)
두수의 곱
func solution(_ num1:Int, _ num2:Int) -> Int {
guard (num1 >= 0 && num1 <= 100), (num2 >= 0 && num2 <= 100) else {
return -1
}
let res = num1 * num2
return res
}
solution(3, 4)
solution(27, 19)
몫 구하기
func solution(_ num1:Int, _ num2:Int) -> Int {
guard (num1 >= 0 && num1 <= 100), (num2 >= 0 && num2 <= 100) else {
return -1
}
let res = num1 / num2
return res
}
solution(10, 5)
solution(7, 2)
728x90
LIST
'SWIFT' 카테고리의 다른 글
[SWIFT] Coding Test Practice Day 3 (0) | 2022.11.09 |
---|---|
[SWIFT] Coding Test Practice Day 2 (0) | 2022.11.08 |
UP and Down Number Game in iOS APP (0) | 2022.11.05 |
UP and DOWN Number Game (0) | 2022.11.05 |
Rock Scissors Paper (0) | 2022.11.04 |