Code:cout << i << " " << j << " " << number-(i+j) << endl;
Printable View
Code:cout << i << " " << j << " " << number-(i+j) << endl;
Great, thanks. :) It gives me every possible prime number combination now I just have to figure out to get only one. Thanks for your help.
For example I let it compute 346
I only want the first answer that it computes. Is there anyway to do that?
Nevermind I figured it out. Thanks a lot everyone! :)
Dang, I finally get that one working and my sum of two primes doesn't work. Is there anyway to change the sum of three primes function to calculate the sum of two primes?
Sure. Just take out one level of the nested loops, i.e. loop from 1 to i, and for each prime 'i' you loop from 1 to (num - i), checking if (num - i) is prime.