Question: C++, Visual Studios Write a boolean function , goldbach, that has 3 integer parameters - one value parameter and two reference parameters. The value parameter
C++, Visual Studios
Write a boolean function , goldbach, that has 3 integer parameters - one value parameter and two reference parameters. The value parameter is an even number, the reference parameters are two prime numbers whose sum is the value parameter. The function returns true if the sum of the reference parameters equals the value parameter. The function returns false otherwise.
e.g.
goldbach(4, a, b) is true where a = 2 and b = 2
goldbach(6, a, b) is true where a = 3 and b = 3
godlbach(8, a, b) is true where a = 3 and b = 5
goldbach(10,a, b) is true where a = 3 and b = 7
goldbach(5, a, b) is true where a = 2 and b = 3.
..
goldbach(23, a, b) is false however.
goldbach will return true for any even number greater than 4. It usually returns false for odd numbers.
Test your function thoroughly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
