UVa : 579 – Clock Hands


/*
User ID: turing_13
Link: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=520
*/

#include <stdio.h>
#include <math.h>

int main ()
{
    double time,angle,hour,min;
    char a;
    while(scanf("%lf %c %lf", &hour,&a,&min) != EOF)
    {
        if(hour==0.00 && min==0.00)
            break;
        angle=(min*6)-(hour*30)-(min/2);
        if(angle<0)
            angle=360+angle;
        if(angle>180)
            angle=360-angle;
        printf("%.3lf\n", angle);

    }
    return 0;
}


Advertisements