시험 성적

C#/Algorithm 2019. 9. 25. 16:13

문제

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

입력

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

출력

시험 성적을 출력한다.

예제 입력 1

100

예제 출력 1

A

코드:

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
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace _9498
{
    class Program
    {
        static void Main(string[] args)
        {
            int score = Convert.ToInt32(Console.ReadLine());
            if (score>=90 && score<=100)
            {
                Console.WriteLine("A");
            }
            else if (score >= 80 && score <= 89)
            {
                Console.WriteLine("B");
            }
            else if (score >= 70 && score <= 79)
            {
                Console.WriteLine("C");
            }
            else if (score >= 60 && score <= 69)
            {
                Console.WriteLine("D");
            }
            else
            {
                Console.WriteLine("F");
            }
        }
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
 

참조:https://www.acmicpc.net/source/15322059

'C# > Algorithm' 카테고리의 다른 글

설탕 배달  (0) 2019.09.25
세 수  (0) 2019.09.25
알람시계  (0) 2019.09.25
윤년  (0) 2019.09.25
두 수 비교하기  (0) 2019.09.25
: