Saturday 18 April 2020

Solution of URI 2685 :: The Change


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

#include <stdio.h>

int main()
{
    int x;
    while(scanf("%d", &x) != EOF)
    {
        x %= 360;
        if(x<90 && x>=0)
            printf("Bom Dia!!\n");
        else if(x>=90 && x<180)
            printf("Boa Tarde!!\n");
        else if(x>=180 && x<270)
            printf("Boa Noite!!\n");
        else if(x>=270 && x<360)
            printf("De Madrugada!!\n");
    }
    return 0;
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.