Auto commit
This commit is contained in:
parent
130450f639
commit
d7b3392f59
33
2207/C语言同步练习/选择结构/1.c
Normal file
33
2207/C语言同步练习/选择结构/1.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(条件){
|
||||||
|
复合语句(条件为真时执行)
|
||||||
|
}else{
|
||||||
|
复合语句(条件为假时执行)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
int main(void){
|
||||||
|
|
||||||
|
int x, y, z, t;//定义三个整型变量
|
||||||
|
//数据类型 变量名1, 变量名2;
|
||||||
|
scanf("%d%d%d", &x, &y, &z);
|
||||||
|
if(x > y){
|
||||||
|
t = x;
|
||||||
|
x = y;
|
||||||
|
y = t;
|
||||||
|
}//实现x和y比较 大数放y位置
|
||||||
|
if(y > z){
|
||||||
|
t = y;
|
||||||
|
y = z;
|
||||||
|
z = t;
|
||||||
|
}//实现y和z比较 大数放z位置 z为三个数字中最大数
|
||||||
|
if(x > y){
|
||||||
|
t = x;
|
||||||
|
x = y;
|
||||||
|
y = t;
|
||||||
|
}
|
||||||
|
printf("%d %d %d\n", x, y, z);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
2207/C语言同步练习/选择结构/1.exe
Normal file
BIN
2207/C语言同步练习/选择结构/1.exe
Normal file
Binary file not shown.
0
2207/C语言同步练习/选择结构/2.c
Normal file
0
2207/C语言同步练习/选择结构/2.c
Normal file
Loading…
x
Reference in New Issue
Block a user