欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2024-01-26 23:08:46
1 #include 2 #include 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 ... ......
 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 }