Function parameters as the return value of the pointer variable A

Questions Description
We all know that the return value of the function can return data to the caller, it is necessary to master the use of a pointer variable method function return values as a function parameter acts. Please help define jingle shaped like the following function:
void Fun (int a, int B, int * SUM, the diff int *, int * Product, a float Divide *)
in the main function, the input two integers a and B, then this function is called a + b, a mathematical calculation - b, a * b values and a / b of the four operations, four operations return to the main function of the function by four parameters; Finally, the main function, four output value calculation. After the division of the decimal point must be kept in claim 2 significant figures (rounded), if less than zero.
Input
input two integers a and b, separated by a space.
Output
Output a b, a + accordance with the subject claim - b, a * b values and a / b, and separated by a space between adjacent values. After the division of the decimal point must be kept in claim 2 significant figures (rounded), if less than zero.
Example Input
25
Output Examples
7-310 0.40
Data range
input range int integer outputs are integers and floating-point float range int range

#include "stdio.h"
void fun(int a, int b, int *sum, int *diff, int *product, float *divide)
{
	*sum=a+b;
	*diff=a-b;
	*product=a*b;
	*divide=a*1.0/b;
}
void main()
{
	int i,a,b,c,d,e,*sum,*diff,*product,*divide;
	float f;
	sum=&c;
	diff=&d;
	product=&e;
	divide=&f;
	scanf("%d %d",&a,&b);
	fun(a,b,&c,&d,&e,&f);
	
	printf("%d %d %d %.2f",c,d,e,f);
	
	
}

Guess you like

Origin blog.csdn.net/Lhw_666/article/details/91415273