5일차 시험점수를 입력받아 학점으로 출력

Console Programming/C# Console 2019. 9. 24. 11:00

논리 연산자 && 나 || 를 사용하지 않고 구성해 보았다.

 

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
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax11
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("시험 점수를 입력하세요.");
            int score = Int32.Parse(Console.ReadLine());
            if (score < 0)
            {
                Console.WriteLine("0~100사이의 값이 아닙니다.");
            }
            else if (score <=100)
            {
                if (score < 60)
                    Console.WriteLine("F");
                else if (score<=69)
                {
                    Console.WriteLine("D");
                }
                else if (score<=79)
                {
                    Console.WriteLine("C");
                }
                else if (score <= 89)
                {
                    Console.WriteLine("B");
                }
                else
                {
                    Console.WriteLine("A");
                }                
            }
            else
            {
                Console.WriteLine("0~100사이의 값이 아닙니다.");
            }
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

: