这个C语言例子成立吗?

来源:百度知道 编辑:UC知道 时间:2024/06/24 07:20:54
#include
#include
main()
{
double x,s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf("sine of %lf is %lf\n",x,s);
}

#include "stdio.h"
#include "math.h"
void main()
{
double x,s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf("sine of %lf is %lf\n",x,s);
}
OK了~!你运行试试~!
你定义变量是双精度实型;但输出是单精度实型~!所以保留6到7位有效数字

s=sin(x); 这是调用的函数吗 怎么没有声明也没有定义啊

sin(x)是"math.h"中的一个函数。