Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigDecimal;
- import java.util.Scanner;
- public class SimpleCalculation {
- public static void main(String[] args) {
- // Read input data
- Scanner input = new Scanner(System.in);
- Double X = input.nextDouble();
- Double Y = input.nextDouble();
- // System.out.println(X1);
- // System.out.println(Y1);
- //
- // BigDecimal X = new BigDecimal(X1);
- // BigDecimal Y = new BigDecimal(Y1);
- // Solve the problem
- if (X.equals(0) && Y.equals(0)) {
- System.out.println(0);
- } else if (X.equals(0)) {
- System.out.println(5);
- } else if (Y.equals(0)) {
- System.out.println(6);
- } else if (X > 0 && Y > 0) {
- System.out.println(1);
- } else if (X < 0 && Y > 0) {
- System.out.println(2);
- } else if (X < 0 && Y < 0) {
- System.out.println(3);
- } else // if (X > 0 && Y < 0)
- {
- System.out.println(4);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement