By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

How to find maximum product of two prime numbers in an array ?

P: 56
I have already posted this question on stackoverflow but still I couldn't get my doubt clarified , my code is not working on 1st and 3rd input ,please clarify this .

http://stackoverflow.com/questions/3...rray/39262723?
Sep 1 '16 #1

✓ answered by weaknessforcats

Forget about prime numbers. Write a function that returns the maximum product of any two members of your array.

Then modify the function so that only members with prime numbers are multiplied.

And you are done.

Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
Forget about prime numbers. Write a function that returns the maximum product of any two members of your array.

Then modify the function so that only members with prime numbers are multiplied.

And you are done.
Sep 1 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.