+ 7
Challenge: The Nearest Prime Number
A positive integer n is called a prime number if its only divisors are "1" and "n" itself. Write a program in any language which receives a positive integer from keyboard and finds its nearest prime number(s). Example for n=2 the nearest prime is itself, for n=10 the nearest prime is 11. Note that some numbers, for example 9, have two nearest prime numbers which are 7 and 11.
11 Réponses
+ 4
Here is my solution in C++:
https://code.sololearn.com/cmwxDIiWYfdL
+ 7
Since nobody has yet answered my challenged, I decided to write a simple program in Java to initiate the challenge. My method isPrime is the simplest possible (and the most naive) algorithm for checking whether a number is prime or not.
Here is my answer to my challenge in Java:
https://code.sololearn.com/cp9Zi8r5hqkN
+ 7
Here's my solution in C++
https://code.sololearn.com/cQnRO0C7F0A3/?ref=app
+ 5
here is my solution for these questions...
check it out
thanx :)
https://code.sololearn.com/cF1b33K4Sg5O/?ref=app
+ 5
@Gordie can you provide link to visit your 2 challenges
+ 3
@Gordie yes I did edit its title :)
+ 1
a whole new refreshing challenge##
try it
https://www.sololearn.com/discuss/817002/?ref=app