20 lines
357 B
C
20 lines
357 B
C
#include <stdio.h>
|
|
|
|
int main(void){
|
|
|
|
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;
|
|
}
|