Code:`cout << i << " " << j << " " << number-(i+j) << endl;`

Printable View

- 03-17-2005spydoorCode:
`cout << i << " " << j << " " << number-(i+j) << endl;`

- 03-17-2005StarOrbs
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? - 03-17-2005StarOrbs
Nevermind I figured it out. Thanks a lot everyone! :)

- 03-17-2005StarOrbs
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?

- 03-17-2005Hunter2
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.