|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 一枚枕头 于 2020-1-27 21:53 编辑
Hello world相关例题 我的代码编译出来与小甲鱼的不同 小甲鱼的可以计算sin30的确定的数值,而我的计算结果是sin30f 请问是哪里出错了呢
#include <stdio.h>
#include <math.h>
void main()
{
double x, s;
printf("input number:\n");
scanf("%If", &x);
s = sin(x);
printf("sin of %If is %If\n", x, s);
}
是 %lf 不是 %If
正确代码:
- #include <stdio.h>
- #include <math.h>
- void main()
- {
- double x, s;
- printf("input number:\n");
- scanf("%lf", &x);
- s = sin(x);
- printf("sin of %lf is %lf\n", x, s);
- }
复制代码
|
|