https://www.youtube.com/watch?v=aUN6p5-Jffs&list=PLO56HZSjrPTB4NxAsEP8HRk6YKBDLbp7m&index=22
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
byte x = 0b1010;
byte y = 0b1100;
WriteLine(Convert.ToString(x & y, 2));
WriteLine(Convert.ToString(x | y, 2));
WriteLine(Convert.ToString(~x, 2));
WriteLine(Convert.ToString(x ^ y, 2));
}
}
}
, 우측 이동(값 감소)
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
byte x = 0b0000_0010;
WriteLine($"{nameof(x),10} : {Convert.ToString(x, 2).PadLeft(8, '0')} -> {x,3} ");
WriteLine($"x = x << 1 : {Convert.ToString(x<<1, 2).PadLeft(8, '0')} -> {x<<1, 3}");
}
}
}
using System;
using static System.Console;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
int number = 10;
string result = (number % 2 == 0) ? "짝" : "홀";
WriteLine($"number({number})는 {result} 입니다.");
}
}
}