부호 없는 정수 데이터 형식을 나타내는 byte, ushort, uint, ulong 키워드를 사용하는 예제를 다음과 같이 입력한 후 실행해 보세요.
부호 없는 정수 데이터 형식 사용: UnsignedInteger.cs
using System;
class UnsignedInteger
{
static void Main()
{
byte iByte = 255;
ushort iUInt16 = 65535;
uint iUInt32 = 4294967295;
ulong iUInt64 = 18446744073709551615;
Console.WriteLine("8비트 byte : {0}", iByte);
Console.WriteLine("16비트 ushort : {0}", iUInt16);
Console.WriteLine("32비트 uint : {0}", iUInt32);
Console.WriteLine("64비트 ulong : {0}", iUInt64);
}
}
실행 결과
8비트 byte : 255 16비트 ushort : 65535 32비트 uint : 4294967295 64비트 ulong : 18446744073709551615