C#
부호 있는 정수 형식과 부호 없는 정수 형식 사이의 변환
JAESEONG LEE- developer
2022. 7. 18. 12:07
예제 프로그램 입니다.
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 데이터 형식의 값의 범위가 출력된 것이 인상깊습니다.