Homework3-4 - printf"\nPlease enter the'y coordinate of...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #3 /* * Program Hw3_4 * Written by Justin Waters * Inputs: (x,y) coordinate points * Outputs: location of the entered point * Description: The user will enter and (x,y) coordinate point and the program tells the user which quadrant or axis line the point is on. * */ #include <stdio.h> //printf, scanf defined #include <math.h> //math functions defined int main (void) { double x, y; //tells user what the program will do printf("By entering an (x,y) coordinate point, \nthis program will tell you which quadrant or axis line\nyour point is on.\n"); //gets 'x' coordinate from user printf("\nPlease enter the 'x' coordinate of your point > "); scanf("%lf", &x); //gets 'y' coordinate from user
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf("\nPlease enter the 'y' coordinate of your point > "); scanf("%lf", &y); if ((x == 0) && (y == 0)) {printf("(%.1lf, %.1lf) is on the origin", x, y);} else if ((x == 0) && (y != 0)) {printf("(%.1lf, %.1lf) is on the y axis", x, y);} else if ((x != 0) && (y == 0)) {printf("(%.1lf, %.1lf) is on the x axis", x , y);} else if ((x < 0) && (y < 0)) {printf("(%.1lf, %.1lf) is in quadrant III", x, y);} else if ((x <0) && (y > 0)) {printf("(%.1lf, %.1lf) is in quadrant II", x, y);} else if ((x > 0) && (y < 0)) {printf("(%.1lf, %.1lf) is in quadrant IV", x, y);} else {printf("(%.1lf, %.1lf) is in quadrant I", x, y);} return (0); }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern