读程序,写出运行结果。#include [stdio.h]main(){ float a,b,c,t;a=3;b=7;c=1;if(a>b) {t=a;a=b;b=t;}if(a>c) {t=a;a=c;c=t;}if(b>c) {t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c); //注意%5.2f 的输出格式与逗号}
举一反三
- 以下程序将3个数从小到大输出 main() { float a,b,c,t; scanf("%f%f%f",&a,&b,&c); if { t=a;a=b;b=t;} if(a>c) {t=a; ;c=t;} if(b>c) {t=b;b=c;c=t} printf("%5.2f,%5.2f,%5.2f\n", ); }
- 读程序题:#include<;stdio.h>;main(){floata,b,c,t;a=3;b=7;c=1;if(a>;b){t=a;a=b;b=t;}if(a>;c){t=a;a=c;c=t;}if(b>;c){t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);}运行结果为
- #include <;stdio.h>;int main(){ float a,b,c,t;a=3;b=7;c=1;if(a>;b){t=a;a=b;b=t;}if(a>;c){t=a;a=c;c=t;}if(b>;c){t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);return 0;}运行结果为:
- 读下列程序: #include void main() { float a,b,t; scanf(”%f,%f”,&a,&b); if(a>b) { t=a; a=b; b=t; } prinff(”%5.2f,%5.2f'’,a,b); } 运行时从键盘输入3.8和-3.4,则正确的输出结果是( )。
- 10.以下程序实现将两个变量数值从大到小输出,完成程序填空。 main() {float a,b,____; scanf(“%f%f”,&a,&b); if(a<b) {t=a; ____; b=t; } printf(“%5.2f, %5.2f\n”,a,b); }