Friday, October 26, 2018

Uri 1041 solution in C | Coordinates of a Point

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

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


 //Happy_Coding

No comments:

Post a Comment