编制一程序,从键盘上读入三个浮点数,在屏幕上显示最大值
#includ<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); int max=0; if(a>b){ if(a>c){max=a; } else{ max=c;} } else{if(b>c){max=b;} else{max=c;} } return 0; }
# include<stdio.h>
int main(void)
{
double a, b, c;
double t;
printf("输入三个浮点数(中间以空格区分):");
scanf("%lf %lf %lf", &a, &b, &c);
if (a > b)
t = a;
else
t = b;
if (t > c)
printf("最大值是%lf\n", t);
else
printf("最大值是%lf\n", c);
return 0;
}
刚学一个星期 应该没错