#include "stdio.h"
void fun(int *x,int *y)
{
int m=*x,n=*y;
int sum,product;//和,积
sum=m+n;
product=m*n;
*x=sum;
*y=product;
}
void main()
{
int a,b;
printf("请输入2个数a和b:");
scanf("%d%d",&a,&b);
fun(&a,&b);
printf("\n\t和= %d ,积= %d\n",a,b);
}
void fun(int *x,int *y)
{
int m=*x,n=*y;
int sum,product;//和,积
sum=m+n;
product=m*n;
*x=sum;
*y=product;
}
void main()
{
int a,b;
printf("请输入2个数a和b:");
scanf("%d%d",&a,&b);
fun(&a,&b);
printf("\n\t和= %d ,积= %d\n",a,b);
}
结果:
请输入2个数a和b:4 6
和= 10 ,积= 24