백준 알고리즘 단계별/if 문
백준 BOJ C# 9488
재호우96
2020. 1. 9. 20:02
반응형
출제 링크 : https://www.acmicpc.net/problem/9498
9498번: 시험 성적
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
코드
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
32
|
using System;
using static System.Console;
namespace baekjoon
{
class Program
{
static void Main(string[] args)
{
string input = Console.ReadLine();
int num = int.Parse(input);
if (100 >= num && 90 <= num)
{
WriteLine("A");
}
else if (89 >= num && 80 <= num)
{
WriteLine("B");
}
else if (79 >= num && 70 <= num)
{
WriteLine("C");
}
else if (69 >= num && 60 <= num)
{
WriteLine("D");
}
else
WriteLine("F");
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
반응형