본문 바로가기
프로그래머/코딩(C#)

_05_if / if문

by FourthWay 2023. 3. 30.
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
반응형

'프로그래머 > 코딩(C#)' 카테고리의 다른 글

_07_if_elseif / if문  (0) 2023.03.31
_06_if else / if문  (2) 2023.03.30
_04_Operator / 비교연산  (2) 2023.03.29
_03_Operator / 연산자  (2) 2023.03.29
_02_Integer  (6) 2023.03.28