Hey guys, I'm new to programming and I think I'm having some fun...
.. we'll see. I cannot for the life of me figure out what's wrong with my program. It takes a cartesian point as input, and is supposed to describe whether that point on an axis or in some quadrant 1-4. I think all my statements follow syntax, the thing compiles just fine, but it only ever gives me an output of "Your point lies in quadrant I". What's so different about that statement that make that always trumps the conditions I set? Please let me know if you see something wrong here.
Thanks!
-Tyler
Code:
//This program finds if a cartesian input point lies on an axis or two, and what quadrant the point is in.
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
int main(void){
double x, y, IQ;
printf("Enter the 'x' coordinate\n");
scanf("%.2fl", x);
IQ = 0;
fflush(stdin);
printf("Enter the 'y' coordinate\n");
scanf("%.2fl", y);
if(y == 0 && x == 0 ) {
printf("Your point lies on both the x and y axis, and exists within no quadrants");
}
else if ( y == 0 && x == !0 )
printf("Your point lies on the x axis");
else if ( y == !0 && x == 0 )
printf("Your point lies on the y axis");
else if ( y > 0 && x > 0 )
printf("Your point lies in quadrant I");
else if ( y > 0 && x < 0 )
printf("Your point lies in quadrant II");
else if ( y < 0 && x < 0 )
printf("Your point lies in quadrant III" );
else if ( y < 0 && x > 0 )
printf("Your point lies in quadrant IV");
return (0);
}