C语言之将弧度值转换为角度值

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 
 4 #define pi 3.141592
 5 
 6 void  conver_radian(float  radian)
 7 {
 8     int degree,minute,second;
 9     float angle,min,sec;
10 
11     angle = radian * 180 / pi;
12     degree = (int)angle;
13 
14     min = (angle - degree)*60;
15     minute = (int)min;
16 
17     sec = (min - minute)*60;
18     second = (int) (sec + 0.5);  //四舍五入
19 
20     printf("%f弧度等于%d度 %d分 %d秒\n",radian,degree,minute,second);
21 }
22 
23 
24 void main()
25 {
26     //将弧度值转换为角度值
27     float radian;
28     
29 
30     printf("请输入弧度值:");
31     scanf("%f",&radian);
32 
33     conver_radian(radian);
34     
35     system("pause");
36     return ;
37 }
 

 

posted @ 2019-03-25 13:59  Jony-2018  阅读(6110)  评论(0编辑  收藏  举报