Venciity

[SoftUni Java] ExamPreparation 01.CartesianCoordinateSystem

May 19th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Program {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.         double x = input.nextDouble();
  9.         double y = input.nextDouble();
  10.  
  11.         if (x == 0 && y == 0){
  12.             System.out.println(0);
  13.         }
  14.         else if (x == 0){
  15.             System.out.println(5);
  16.         }
  17.         else if (y == 0){
  18.             System.out.println(6);
  19.         }
  20.         else if (x > 0 && y > 0){
  21.             System.out.println(1);
  22.         }
  23.         else if (x < 0 && y > 0){
  24.             System.out.println(2);
  25.         }
  26.         else if (x < 0 && y < 0){
  27.             System.out.println(3);
  28.         }
  29.         else if (x > 0 && y < 0){
  30.             System.out.println(4);
  31.         }
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment