coderrohan14

Conditionals_Ques_4.java

Jun 24th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int x=sc.nextInt(),y=sc.nextInt();
  7. if(x==0&&y==0){
  8. System.out.println("Origin");
  9. }else if(x==0){
  10. System.out.println("Y axis");
  11. }else if(y==0){
  12. System.out.println("X axis");
  13. }else{
  14. if(x>0&&y>0){
  15. System.out.println("Quadrant 1");
  16. }else if(x<0&&y>0){
  17. System.out.println("Quadrant 2");
  18. }else if(x<0&&y<0){
  19. System.out.println("Quadrant 3");
  20. }else{
  21. System.out.println("Quadrant 4");
  22. }
  23. }
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment