// 1.计算1-100中7的倍数的个数
#include <stdio.h>
int he(int a,int b);
int cha(int a,int b);
int chengJi(int a,int b);
double sheng(int a,int b);
int main(int argc, const char * argv[]) {
printf("请输入两个数");
int a = 0 ,b = 0;
scanf("%d%d",&a,&b);
printf("和为%d\n",he(a, b));
printf("差为%d\n",cha(a, b));
printf("乘积为%d\n",chengJi(a, b));
printf("商为%.2lf\n",sheng(a, b));
return 0;
}
int he(int a,int b){
return a+b;
}
int cha(int a,int b){
return a-b;
}
int chengJi(int a,int b){
return a*b;
}
double sheng(int a,int b){
if (b == 0) {
return 0;
}
return a/b*1.0;
}
|
|