发布网友 发布时间:2022-04-22 00:10
共1个回答
热心网友 时间:2023-06-05 04:01
灞曞紑鍏ㄩ儴#include <stdio.h>
int main(){
int h,m;float ang;
printf("Please input time(e.g:5h43m):");
while(scanf("%dh%dm",&h,&m)!=EOF){
while(h<0||h>12||m<0||m>60){
printf("Input data error!Plese input again!\n");
printf("Please input time(e.g:5h43m):");
scanf("%dh%dm",&h,&m);
}
ang=fabs(h*30+m*0.5-m*6);
if(ang>=180) ang=360-ang;
printf("AT %d:%02d the angle is %.1f degrees.\n",h,m,ang);
printf("Please input time(e.g:5h43m):");
}
return 0;
}