예제 프로그램 입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System;
namespace signedUnsignedConversion
{
class MainApp
{
static void Main(string[] args)
{
int a = 500;
Console.WriteLine(a);
uint b = (uint)a;
Console.WriteLine(b);
int x = -30;
Console.WriteLine(x);
uint y = (uint)x;
Console.WriteLine(y);
}
}
}
|
cs |

실행 결과를 보니 unit 데이터 형식의 값의 범위가 출력된 것이 인상깊습니다.
'C#' 카테고리의 다른 글
문자열을 숫자로, 숫자를 문자열로 변환 (0) | 2022.07.18 |
---|---|
부동 소수점 형식과 정수 형식 사이의 변환 (0) | 2022.07.18 |
크기가 서로 다른 부동 소수점 형식 사이의 변환 (0) | 2022.07.18 |
크기가 서로 다른 정수 형식 사이의 변환 (0) | 2022.07.15 |
박싱과 언박싱에 대한 이해 (0) | 2022.07.15 |