Q. Coordinates of a Point – Codeforces Problem Solution in C

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/Q

//https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/Q
//Knowing the value in which Coordinates of a Point
#include<stdio.h>
int main() {
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a==0 && b==0){
        printf("Origem");
    }
    else if(b==0){
        printf("Eixo X");
    }
    else if(a==0){
        printf("Eixo Y");
    }
    else if(a>0 && b>0){
        printf("Q1");
    }
    else if(a<0 && b>0){
        printf("Q2");
    }
    else if(a<0 && b<0){
        printf("Q3");
    }
    else if(a>0 && b<0){
        printf("Q4");
    }
    return 0;
}

Assiut University Training – Newcomers solution

Leave a Comment