#C5265. Largest Prime Number Below N
Largest Prime Number Below N
Largest Prime Number Below N
You are given an integer n
. Your task is to find the largest prime number strictly less than n
.
If no prime number exists that is less than n
(for example, when n <= 2
), output the message No prime number found
.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The solution must read the input from standard input (stdin) and print the output to standard output (stdout).
For example:
- If the input is
10
, then the output should be7
. - If the input is
2
, then the output should beNo prime number found
.
inputFormat
The input consists of a single integer n
provided through standard input (stdin).
outputFormat
The output should be a single line, which is either the largest prime number less than n
or the message No prime number found
if no such prime exists. The output should be printed to standard output (stdout).
10
7