Geralds Mod
March 13th, 2008, 04:50 PM
I need help making an algorithm that finds 2 numbers that add to a certain number and multiply to a certain number.
Something like this...
Take the numbers 9 and 18 for example.
I need 2 numbers whose sum is 9 and whose product is 18.
The numbers 6 and 3 work because 6 + 3 = 9 and 6 * 3 = 18.
So I need something kinda along the lines of:
void guess_and_check(int a, int b)
{
// finds the 2 numbers here
}
Anyone got any idea's?
I kinda got coders block.
Something like this...
Take the numbers 9 and 18 for example.
I need 2 numbers whose sum is 9 and whose product is 18.
The numbers 6 and 3 work because 6 + 3 = 9 and 6 * 3 = 18.
So I need something kinda along the lines of:
void guess_and_check(int a, int b)
{
// finds the 2 numbers here
}
Anyone got any idea's?
I kinda got coders block.