시험 성적 (9498)

Created:

Baekjoon No.9498
이전 문제에서 조건만 많아진 if문

Bash

Bash
1
2
3
4
5
6
7
8
read a
o="F"
if [ 90 -le $a ]; then o="A"
elif [ 80 -le $a ]; then o="B"
elif [ 70 -le $a ]; then o="C"
elif [ 60 -le $a ]; then o="D"
fi
echo $o

C

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>

int main(void) {
	int a;
	scanf("%d", &a);

	if (90 <= a) { printf("A\n"); }
	else if (80 <= a) { printf("B\n"); }
	else if (70 <= a) { printf("C\n"); }
	else if (60 <= a) { printf("D\n"); }
	else { printf("F\n"); }

	return 0;
}

Node.js

JavaScript
1
2
3
4
5
6
7
let a = Number(require("fs").readFileSync(0).toString().trim());
let o = "F";
if (90 <= a) { o = "A"; }
else if (80 <= a) { o = "B"; }
else if (70 <= a) { o = "C"; }
else if (60 <= a) { o = "D"; }
console.log(o);

PHP

PHP
1
2
3
4
5
6
7
8
9
<?php
	fscanf(STDIN, "%d", $a);
	$o = "F";
	if (90 <= $a) { $o = "A"; }
	else if (80 <= $a) { $o = "B"; }
	else if (70 <= $a) { $o = "C"; }
	else if (60 <= $a) { $o = "D"; }
	echo $o;
?>

Python3

Python
1
2
3
4
5
6
7
a = int(input())
o = "F"
if 90<=a: o = "A"
elif 80<=a: o = "B"
elif 70<=a: o = "C"
elif 60<=a: o = "D"
print(o)

Ruby

Ruby
1
2
3
4
5
6
7
8
a = gets.chomp.to_i
o = "F"
if 90<=a; o = "A"
elsif 80<=a; o = "B"
elsif 70<=a; o = "C"
elsif 60<=a; o = "D"
end
puts o