编写程序,定义一个 int 型变量 a ,一个 float 型变量 b ,一个 double 型变量 c , a 变量初始化为20, b 变量赋值为12.345, c 变量的值从键盘输入,调用 printf 函数输出3个变量的值,输出时给出较清晰的提示信息。
说明:(1)scanf之前无需用printf给提示信息 。
(2)实数的输入格式控制用%lf
#include <stdio.h>
int main()
{
int a=20;
float b=12.345;
double c;
scanf("%lf",&c);
printf("a=%d\n",a);
printf("b=%f\n",b);
printf("c=%lf",c);
return 0;
}
这个为什么错了?