5일차 시험점수를 입력받아 학점으로 출력 (2) 논리연산자 사용
Console Programming/C# Console 2019. 9. 24. 11:05논리 연산자 && 와 ||를 사용하여 구성하였다.
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax11
{
class Program
{
static void Main(string[] args)
{
Console.Write("시험 점수를 입력하세요.");
if (score < 0 || score >100)
{
Console.WriteLine("0~100사이의 값이 아닙니다.");
}
else if (score <= 100 && score >= 90)
{
Console.WriteLine("A");
}
else if (score <= 89 && score >= 80)
{
Console.WriteLine("B");
}
else if (score <= 79 && score >= 70)
{
Console.WriteLine("C");
}
else if (score <= 69 && score >= 60)
{
Console.WriteLine("D");
}
else
{
Console.WriteLine("F");
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
![](https://blog.kakaocdn.net/dn/cnny8B/btqyt6AQtRu/XlJHvx3p60K7qN43m0W6K1/img.png)
'Console Programming > C# Console' 카테고리의 다른 글
5일차 세 개의 정수를 입력받아 두번째로 큰 수 출력 --------코드 수정 (0) | 2019.09.24 |
---|---|
5일차 세 개의 정수를 입력받아 두번째로 큰 수 출력 (0) | 2019.09.24 |
5일차 시험점수를 입력받아 학점으로 출력 (0) | 2019.09.24 |
성적입력 프로그램 1일차 (0) | 2019.09.23 |
행렬 Col 과 Row를 입력받기 (0) | 2019.09.23 |