设有定义:double x=5.1012;,若要求只输出 x 的整数部分,以下不能实现此要求的语句是 A) printf ( " x=%1.0lf\n",x); B)printf ( " x=%2.0f\n",x); C)printf ( " x=%.0f\n",x); D) printf ( " x=%2d\n",x);
A) printf ( " x=%1.0lf\n",x); B)printf ( " x=%2.0f\n",x); C)printf ( " x=%.0f\n",x);
.0表示输出浮点数时不带小数位
答案:D
用户登录可进行刷题及查看答案
登录后提交答案