为了账号安全,请及时绑定邮箱和手机立即绑定

向大佬提问,为什么我输a=1.1,b=1.1,结果s却是一堆懵逼的数字?

向大佬提问,为什么我输a=1.1,b=1.1,结果s却是一堆懵逼的数字?

C
依木兰 2018-11-24 21:23:34
#include<math.h>double area(double a,double b){double s=a*b;return s;}#include<stdio.h>main(){ double a, b ,s;printf("how much is your long");scanf("%f",&a);printf("how much is your wide");scanf("%f",&b);s=area(a,b);printf("%f",s);}
查看完整描述

3 回答

已采纳
?
___C___

TA贡献168条经验 获得超109个赞

double要用%lf格式,float才是%f格式。

例如要修改为scanf("%lf",&a);


感谢采纳

查看完整回答
反对 回复 2018-11-30
  • 3 回答
  • 0 关注
  • 733 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信