Code difficulty: 3/10
Math difficulty: 4/10
In this challenge I ask that you do the following things:
Create a program that will:
- Allow a user to input a number
- Allow the user to see if the number is prime or not
- If the number is not prime, tell the user what number it is divisible by
- Use a function to process whether or not the value is prime (this idea will be used in a future challenge
- Use double or Long for increased number length
Concepts used: Functions, variables, loops, arithmatic functions, breaks, boolean
You should be able to do this by: Lesson 33
My solution: http://ideone.com/AKmCm (spoilers- Don’t look unless you are really stuck!)
Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.