scanf("%f,%f,%f",&a,&b,&c);要改成scanf("%lf,%lf,%lf",&a,&b,&c);printf语句中也是,因max是double型的要改%f为%lf 如果想用%f输入输出,可以不做上述修改而将程序中double改成float
include <stdio.h>void main(){int i,max,min,n;scanf("%d",&n);max=n;min=n;for(i=1;i<10;i++){scanf("%d",&n);if(max<n) max=n;if(min>n) min=n;}printf("最大数:%d,最小数:%d",max,min);}运行示例:
min=~max,i; for(i=0;i<5;i++){ if(scanf("%d",&n) && n>max) max=n; if(n<min) min=n; } printf("The max is %d\nThe min is %d\n",max,min); return 0;}