夹角有多大

在这里插入图片描述

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    double  c,a,b,h,m,s;
    scanf("%lf %lf %lf",&h,&m,&s);
    if(h>=12)
        h=h-12;
    c=30*h+m/2+s/120-6*m-s/10;
    c=fabs(c);
    if(c<=180)
    {
        if(c!=0)
        printf("%.0d",(int)c);
        else
            printf("0");
    }

    else
        printf("%.0d\n",(int)(360-c));
    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_43382549/article/details/84503579
今日推荐