Header Ads

Header ADS

Solution of URI 1041::Coordinates of a Point

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problem, you will inform me by comment.




#include <stdio.h>
int  main()
{
    float x,y;
    scanf("%f%f",&x,&y);
    if (x>0&&y>0) {
        printf("Q1\n");
    }
    i
f (x<0&&y>0) {
        printf("Q2\n");
    }
    if (x<0&&y<0) {
        printf("Q3\n");
    }
    if (x>0&&y<0) {
        printf("Q4\n");
    }
    if (x==0&&y==0) {
        printf("Origem\n");
    }
    if ((x>0||x<0)&&y==0) {
        printf("Eixo X\n");
    }
      if ((y>0||y<0)&&x==0) {
        printf("Eixo Y\n");
    }

    return 0;
}

No comments

Theme images by konradlew. Powered by Blogger.