[Swift] 백준알고리즘 #9498

r1verfuture·2021년 10월 22일
0

백준알고리즘

목록 보기
2/110

📝 문제

시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.

⌨️ 입력

첫째 줄에 시험 점수가 주어진다. 시험 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.

🖨 출력

시험 성적을 출력한다.

⌨️ 예제 입력

100

🖨 예제 출력

A

📚 내가 제출한 코드

let input = readLine()!
let inputInt = Int(input)!
if inputInt >= 90 && inputInt <= 100 {
	print("A")
} else if inputInt >= 80 && inputInt <= 89 {
	print("B")
} else if inputInt >= 70 && inputInt <= 79 {
	print("C")
} else if inputInt >= 60 && inputInt <= 69 {
	print("D")
} else {
	print("F")
}

✏️ 내가 제출한 코드에 대한 설명

  • readLine() : 키보드로 입력한 값을 받는 함수
  • 메모리 : 79160 KB
  • 시간 : 12 ms
  • 코드 길이 : 329 B
profile
#iOS #Swift #Developer #Python

0개의 댓글