#include <stdio.h>
void jiaAndjianChengChu(int a,int b,int *jia,int *jian,int *cheng,float *chu){
*jia = a+b;
*jian = a-b;
*cheng = a*b;
*chu = (float)a/b;
}
int main(){
//定义两个变量进行运算
int a = 5;
int b = 7;
//定义变量用于接收计算的值
int jia,jian,cheng;
float chu;
//调用函数
jiaAndjianChengChu(a,b,&jia,&jian,&cheng,&chu);
//打印出结果
printf("jia = %d\njian = %d\ncheng = %d\nchu = %.2f\n",jia,jian,cheng,chu);
return 0;
} |
|