BOJ 코딩테스트/Bronze
BOJ 9498번 : 시험 성적 (Python, Java, C/구현/Bronze 5)
dev스카이
2024. 3. 17. 23:26
9498번: 시험 성적
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
설명
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
Solution
Python
score = int(input())
if 100 >= score and score >= 90:
print('A')
elif 89 >= score and score >= 80:
print('B')
elif 79 >= score and score >= 70:
print('C')
elif 69 >= score and score >= 60:
print('D')
else:
print('F')
Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int score = sc.nextInt();
if(100 >= score && score >= 90) {
System.out.println('A');
} else if (89 >= score && score >= 80) {
System.out.println('B');
} else if (79 >= score && score >= 70) {
System.out.println('C');
} else if (69 >= score && score >= 60) {
System.out.println('D');
}else {
System.out.println('F');
}
}
}
C
#include <stdio.h>
int main() {
int score;
scanf("%d", &score);
if (score >= 90)
printf("A");
else if (score >= 80)
printf("B");
else if (score >= 70)
printf("C");
else if (score >= 60)
printf("D");
else
printf("F");
return 0;
}