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

Info iconThis 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background 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

This note was uploaded on 08/06/2008 for the course EGR 261 taught by Professor Parikh during the Spring '08 term at Grand Valley State.

Page1 / 2

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online