C语言习题5.23--利用参数宏进行角…

Description

定义参数宏AngleToRadian(degree,minute,second),将度(degree)、分(minute)、秒(second)转换为弧度。(#define PI 3.14159

#include
#define PI 3.14159

 

在此补充缺少的代码

 

int main()
{
    double degree,minute,second;
    scanf("%lf %lf %lf",°ree,&minute,&second);
    printf("%f",AngleToRadian(degree,minute,second));
    return 0;
}

Input

度,分,秒

Output

转换后的弧度

Sample Input

180 0 0

Sample Output

3.141590


  1. #include
  2. #define PI 3.14159
  3. double AngleToRadian(double degree,double minute,double second);
  4. double AngleToRadian(double degree,double minute,double second)
  5. {
  6.     minute+=second/60;
  7.     degree+=minute/60;
  8.     return degree/180*PI;
  9. }
  10. int main()
  11. {
  12.     double degree,minute,second;
  13.     scanf("%lf %lf %lf",°ree,&minute,&second);
  14.     printf("%f",AngleToRadian(degree,minute,second));
  15.     return 0;










你可能感兴趣的:(计153-12和计155—7)