1041 - Coordinates of a Point - URI Online Judge || URI Online Judge 1041 Coordinates of a Point Solution

Problem Name: Coordinates of a Point
Problem Code: 1041
Judge: URI Online Judge
Problem link: 1041 - Coordinates of a Point
Solution on GitHub: 1041 - Coordinates of a Point



URI Online Judge 1041 - Coordinates of a Point Solution in C++/Cpp

#include <iostream>
using namespace std;

int main()
{
    float x, y;
    cin >> x >> y;
    if (x == 0 && y == 0)
    {
        cout << "Origem" << endl;
    }
    else if (y == 0)
    {
        cout << "Eixo X" << endl;
    }
    else if (x == 0)
    {
        cout << "Eixo Y" << endl;
    }
    else
    {
        if (x > 0 && y > 0)
        {
            cout << "Q1" << endl;
        }
        else if (x > 0 && y < 0)
        {
            cout << "Q4" << endl;
        }
        else if (x < 0 && y > 0)
        {
            cout << "Q2" << endl;
        }
        else
        {
            cout << "Q3" << endl;
        }
    }

    return 0;
}





Next Post Previous Post
No Comment
Add Comment
comment url