Hello world相关例题 我的代码编译出来与小甲鱼的不同 .
本帖最后由 一枚枕头 于 2020-1-27 21:53 编辑Hello world相关例题 我的代码编译出来与小甲鱼的不同 小甲鱼的可以计算sin30的确定的数值,而我的计算结果是sin30f请问是哪里出错了呢{:5_92:}
#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);
} zltzlt 发表于 2020-1-27 21:59
是 %lf 不是 %If
正确代码:
我改正了代码后还是输出sin30f{:5_105:} 2楼是正解,你代码书写的肯定有问题。
input number:
30
sin of 30.000000 is -0.988032 chxchxkkk 发表于 2020-1-28 16:06
2楼是正解,你代码书写的肯定有问题。
input number:
30
好的 谢谢你呀
页:
[1]