[백준] C# : 사분면 고르기 (14681번)

ssu_hyun·2022년 7월 12일
0

Data Structure & Algorithm

목록 보기
24/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());

            if (x > 0 && y > 0) { Console.WriteLine(1); }
            else if (x < 0 && y > 0) { Console.WriteLine(2); }
            else if (x < 0 && y < 0) { Console.WriteLine(3); }
            else if (x > 0 && y < 0) { Console.WriteLine(4); }
        }
    }
}
  • 논리 연산자
    • 논리곱 연산자( && : AND )
    • 논리합 연산자( || : OR )
    • 부정 연산자( ! : NOT )

0개의 댓글