프로그래머/코딩(C#)
_05_if / if문
FourthWay
2023. 3. 30. 07:58
728x90
반응형
namespace _05_if
{
internal class Program
{
static void Main(string[] args)
{
int num = 0;
Console.Write("숫자를 입력하세요: ");
// "100"
string strNum = Console.ReadLine();
// "100" => 100
num = Int32.Parse(strNum);
// num이 100과 같으냐? 같으면 True, 다르면 False
// if문은 결과가 True일 때만 안으로 진입하여 실행
if(num == 100)
{
Console.WriteLine("num은 100입니다");
}
}
}
}
728x90
반응형