Write a program that prompts the user for an x and a y coordinate in the Cartesi
ID: 3648570 • Letter: W
Question
Write a program that prompts the user for an x and a y coordinate in the Cartesian planeand prints out a message indicating if the point (x; y) lies on an axis (x or y axis, or both) or what
quadrant it lies in
Explanation / Answer
float x,y; scanf("%f%f",&x,&y); if(x ==0 && y==0){ printf("origin"); } if(x == 0){ printf("point lies on y axis"); } else if(y == 0){ printf("point lies on x axis"); } else if(x > 0){ ...............if(y > 0){ .........................printf("1st quad"); .........................} .............else{ ..................printf("4th quad"); .................} .............} else { ......if(y > 0){ .............printf("2nd quad"); ................} ......else { ...........printf("3 rd quad"); ...........} .....}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.