Accept Simple Point from the keyboard and check whether it is a origin on x axis, on y axis or in 1st quadrant or in 2nd or in 3rd or in 4th quadrant where exactly the point can be?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace quadrant
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            Console.WriteLine("Please Enter the Point x and y (Ex: 1,2)");
            a=int.Parse(Console.ReadLine());
            b=int.Parse(Console.ReadLine());
            if (a == 0 && b == 0)
            {
                Console.WriteLine("Origin");
            }
            if (a>0 && b>0)
            {
                Console.WriteLine("first quadrant");
            }
            if (a < 0 && b > 0)
            {
                Console.WriteLine("second quadrant");
            }
            if (a < 0 && b < 0)
            {
                Console.WriteLine("third quadrant");
            }
            if (a > 0 && b < 0)
            {
                Console.WriteLine("fourth quadrant");
            }
        }
    }
}
Admin

Admin

Powered by Blogger.