为什么输出的结果和计算器得到的不一样?


int main()
{
    double a, b;
    printf("请输入夸脱数");
    scanf("%lf", &a);
    b= (a * 950)/( 3*10 ^ (-23));
    printf("水分子数为%lf", b);
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/255672786546134.png "#left")


^在c中是异或的意思,并不是幂运算
使用math.h中的pow函数进行幂运算
类似

 #include<math.h>
 #include<stdio.h>
int main()
{
    double a, b;
    printf("请输入夸脱数");
    scanf("%lf", &a);
    b= (a * 950)/( 3*pow(10,-23));
    printf("水分子数为%lf", b);
}

b = a * 950 / 3.0 * pow(10,23);

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632