Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CartesianCoordinateSystem
- {
- static void Main()
- {
- //Telerik Academy
- //You are given a two-dimensional Cartesian coordinate system and the two coordinates (X and Y) of a point in the coordinate system. As you will find, the coordinate system is divided by 2 lines (see the picture bellow) which divide the plain in four parts. Each of these parts has a lot of points that are numbered between 1 and 4. There is one point where our lines are crossing. This point has the following coordinates: X=0 and Y=0. As a result this point is numbered 0. The points on the lines are also numbered with the numbers 5 and 6 (again see the picture below).
- //Your task is to write a program that finds the number of the location of the given point in the coordinate system.
- double coordinateX = double.Parse(Console.ReadLine()),
- coordinateY = double.Parse(Console.ReadLine());
- if (coordinateX == 0 && coordinateY == 0)
- {
- Console.WriteLine("0");
- }
- else if (coordinateX > 0 && coordinateY > 0)
- {
- Console.WriteLine("1");
- }
- else if (coordinateX < 0 && coordinateY > 0)
- {
- Console.WriteLine("2");
- }
- else if (coordinateX < 0 && coordinateY < 0)
- {
- Console.WriteLine("3");
- }
- else if (coordinateX > 0 && coordinateY < 0)
- {
- Console.WriteLine("4");
- }
- else if (coordinateX == 0 && coordinateY != 0)
- {
- Console.WriteLine("5");
- }
- else if (coordinateX !=0 && coordinateY == 0)
- {
- Console.WriteLine("6");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement