program to print quadrant for given coordinates
today we are going to a Program takes the coordinate point as input and finds out its quadrant.
The program takes the input and
for the value which are being entered in X and Y we need to find in which quadrant the points will occur.
The program takes the input and
for the value which are being entered in X and Y we need to find in which quadrant the points will occur.
Hello friends , today we are going
to perform simple task which is finding the quadrants of a given number,
A number can lie in 4 different quadrants,
depending upon the nature of number we are able to find the quadrant it will lay.
So whenever you want to find the quadrant just look for the sign of the number
and you would be able to judge the quadrant.
It plays a major role as these
values are required while calculating the value of trigonometric function.
How to make it is a big question?
What all would be the requirements?
The simple logic behind the program is to input the number from the
user and ,then need to compare the number depending upon the number we are able
to find the required information so ,using if condition you would be able to do
so.
First trick of step 1 you would be requiring
for the code so ,if you have thought then move to next step ,think what should
be the output of the code ,make line by line approach and you will be able to
do that task.
c4fun brings you the code of the C program to find the coordinatate and find out its quadrant.
#include<conio.h>
void main()
{
int x,y;
clrscr();
printf("\n enter coordinates");
scanf("%d%d",&x,&y);
if(x>0&&y>0)
printf*("\n 1 quardant");
else if(x<0&&y>0)
printf("2 nd quadrant");
else if(x<0&&y<0)
printf("\n 3rd quadrant");
else if(x>0&&y<0)
printf("\n 4th quardrant");
else
printf("\n at origin");
getch();
}
the output can be changed by entering the positive value aobg with the negative value.
comment the different output which you obtained while coding
and try new combinations of points which you can think of.
When you have done coding and
testing now it’s time to share the result you have obtained from the program
Comment down the result you aver
obtained while running your code?
Was the result as expected by you
if not what was the error?
Share your vies was the program
really difficult after you have used the source code?
Share this program among your
friends whom you think it would help them as when you build the simple program
then you build and boost up your confidence so do share the blog among your friends
and remember sharing is caring so share
as much as u can.
If you have any doubt or query or
any problem, comment down the question if comment section and it would be
resolve as soon as possible.
Keep coding ….and keep yourself
updated which is the most important thing required in the field of coding, as
things keep changing every moment.
Keep sharing…..
Keep learning….
nice great article...
ReplyDelete