# Program to find the quadrant in which the given coordinates lie | faceprep

Program to find the quadrant in which the given coordinates lie is discussed here. Input a point from the user and find the quadrant in which the given coordinates lie.

DESCRIPTION

if it is in center display Origin

Input format:

• Input consist of 2 integers.
• First input corresponds to x co-ordinate.
• Second input corresponds to y co-ordinate.

Sample Input and Output:

Input:

5
6

Output:

## Program to find the quadrant in which the givencoordinates lie

// C program to find the quadrant in which the given coordinates lie

#include
int main()
{
//Fill the code
int a,b;
scanf(“%d %d”,&a,&b);
if(a > 0 && b > 0)
else if(a < 0 && b > 0)
else if(a < 0 && b < 0)
else if(a > 0 && b < 0)
else
printf(“Origin”);
return 0;
}

// C++ program to find the quadrant in which the given coordinates lie

#include
using namespace std;

int main()
{
//Fill the code
int a,b;
cin >> a >> b;
if(a > 0 && b > 0)
else if(a < 0 && b > 0)
else if(a < 0 && b < 0)
else if(a > 0 && b < 0)
else
cout << “Origin”;
return 0;
}

// Java program to find the quadrant in which the given coordinates lie

import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a,b;
a = sc.nextInt();
b = sc.nextInt();
if(a > 0 && b > 0)
else if(a < 0 && b > 0)
else if(a < 0 && b < 0)
else if(a > 0 && b < 0)
else
System.out.print(“Origin”);
}
}

# Python program to find the quadrant in which the given coordinates lie

a = int(input())
b = int(input())
if(a > 0 and b > 0): 