Write a C program to accept the x and y coordinate of a point and find the quadrant in which the point lies.
#include<stdio.h>
#include<conio.h>
void main()
{
float x,y;
//accept x and y values from user
printf("\nEnter value of x: ");
scanf("%f",&x);
printf("\nEnter value of y: ");
scanf("%f",&y);
//check in which quadrant points are belong
if(x>0&&y>0)
{
printf("\nPoints are belongs in I quadrant.");
}
if(x<0&&y<0)
{
printf("\nPoints are belongs in III quadrant.");
}
if(x<0&&y>0)
{
printf("\nPoints are belongs in II quadrant.");
}
if(x>0&&y<0)
{
printf("\nPoints are belongs in IV quadrant.");
}
getch();
}
0 Comments