• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I get solution for this query

 
Ravi Pydi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a Java Program that can print all the possible Combinations of a Digital LocK Key code which consists of 3 Numbers with the following constraints:
The Sum of the Numbers cannot Exceed 1000
No two numbers can be multiples of each other. Like 10 and 20 cannot be part of the Key Code.
Atleast One number has to a Prime Number in the Key Code.
Each Number should be greater than or equal to 1 and less than or equal to 500
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't post homework questions. Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.

-- How To Ask Questions The Smart Way by Eric Steven Raymond
 
fred rosenberger
lowercase baba
Bartender
Posts: 12186
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Break the problem down into smaller parts.

start off by figuring out how to print all the possible combinations. Note that you may NOT want to start with 1-500, but maybe something simpler like 1-5 for each value.

once you do that, add the constraints one at a time, test each as you go, and compile/test OFTEN.

come back if you have more questions... the more specific the better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic