Auto commit
This commit is contained in:
parent
9110054b2c
commit
d099950411
19
2207/C语言同步练习/选择结构/3.c
Normal file
19
2207/C语言同步练习/选择结构/3.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
|
||||
float a, b, result;
|
||||
int flag;
|
||||
printf("请输入两个数字:");
|
||||
scanf("%f %f", &a, &b);
|
||||
printf("请输入您要进行的操作(1.做加法 2.做乘法 3.做除法):");
|
||||
scanf("%d", &flag);
|
||||
switch(flag){
|
||||
case 1:result = a+b;break;
|
||||
case 2:result = a*b;break;
|
||||
case 3:result = a/b;break;
|
||||
}
|
||||
printf("结果为%f\n", result);
|
||||
|
||||
return 0;
|
||||
}
|
BIN
2207/C语言同步练习/选择结构/3.exe
Normal file
BIN
2207/C语言同步练习/选择结构/3.exe
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user