0
Plz try
Can we get both sum and product of two integers by calling a single function?
2 Answers
+ 6
You mean like this?
struct ReturnInfo
{
int sum;
int product;
};
ReturnInfo SumAndProduct(int a, int b)
{
ReturnInfo returnInfo.
returnInfo.sum = a + b;
returnInfo.product = a * b;
return returnInfo;
}
+ 3
Actually you cant. If you want direct results, it is impossible.
However there is a workaround, as explained by __IAS__. This way you ask a function to obtain a result set which includes all the values or properties required.
Hot today
Python — File Handling
0 Votes
Help me solve this (using loop)
3 Votes
What is wrong? Error on test.
1 Votes
Help me wiht python
1 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
Help me
0 Votes