int main(){ double a = 0.05; int n = 0; while._折纸珠穆朗玛峰编程c语言">
赞
踩
- #include<stdio.h>
- int main()
- {
- float h=0.05;
- int n=0;
- while(h<=8848000)
- {
- n=n+1;
- h=h*2;
- printf("%d,%.2f\n",n,h);
-
- }
-
- return 0;
- }
- //
- #include<stdio.h>
- int main()
- {
- double a = 0.05;
- int n = 0;
-
- while (a <= 8848000)
- {
- n = n + 1;
- a = a*2;
- printf("%d,%.2lf\n",n,a);
- }
- return 0;
- }
用double和float最后输出结果不同。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。