C语言计算角度的正弦值(保留两位小数)
#include <stdio.h>
#include <math.h>
int main()
{
double angle, radian, sine;
const double PI = 3.14159;
printf("Please input an angle in degrees: ");
scanf("%lf", &angle);
radian = angle * PI / 180.0; // convert degree to radian
sine = sin(radian); // calculate sine value
printf("The sine of %lf degrees is %.2lf.\n", angle, sine);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/oJTG 著作权归作者所有。请勿转载和采集!