UVa 579 - Clock Hands

#include<stdio.h>
int main()
{
    int h,m;
    float angle,temp,p;
    while(scanf("%d:%d",&h,&m)==2)
    {
        if(h==0 && m==0)
            break;
        if(h==12)
            h=0;
        angle=((float)h*30)+((float)m*0.5);
        temp=(float)m*6;
        if(temp>angle)
        {
            p=temp;
            temp=angle;
            angle=p;
        }
        angle-=temp;
        if(angle>180)
            angle=360-angle;
        printf("%.3f\n",angle);
    }
    return 0;
}
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 মন্তব্য(গুলি):

একটি মন্তব্য পোস্ট করুন