保留小数问题
# include<stdio.h>
int add(int,int);
int reduce(int,int);
int mul(int,int);
float divide(int,int);
int main()
{
int x,y,a,b,c;
float d;
scanf("%d %d",&x,&y);
a=add(x,y);
b=reduce(x,y);
c=mul(x,y);
d=divide(x,y);
printf("The add is:%d\n",a);
printf("The reduce is:%d\n",b);
printf("The mul is:%d\n",c);
printf("The divide is:%3f\n",d);
}
int add(int e,int f)
{
int add;
add=e+f;
return add;
}
int reduce(int e,int f)
{
int reduce;
reduce=e-f;
return reduce;
}
int mul(int e,int f)
{
int mul;
mul=e*f;
return mul;
}
float divide(int e,int f)
{
float divide;
divide=e/f;
return divide;
}