psotirov

Cartesian Coordinate System

Dec 10th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2.  
  3. class CartesianCoordinateSystem
  4. {
  5.     static void Main()
  6.     {
  7.         double x = double.Parse(Console.ReadLine()); // reads coordinates
  8.         double y = double.Parse(Console.ReadLine());
  9.  
  10.         int result = 0;
  11.         if (x > 0 && y > 0) result = 1;
  12.         if (x < 0 && y > 0) result = 2;
  13.         if (x < 0 && y < 0) result = 3;
  14.         if (x > 0 && y < 0) result = 4;
  15.         if (x == 0 && y != 0) result = 5;
  16.         if (x != 0 && y == 0) result = 6;
  17.         Console.WriteLine(result);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment