Dsa
Math
Easy
Prime Numbers in Range
Write a program that determines all prime numbers in a given range. The program should read two integers, `start` and `end`, and print all prime numbers between these two numbers (inclusive). A prime number is a number greater than 1 that has no positive divisors other than 1 and itself.
Input format:
Two integers `start` and `end` where 1 <= start <= end <= 10000.
Output format:
A list of prime numbers in the range from `start` to `end`, printed on a single line, separated by spaces.
Example:
Input:
10 20
Output:
11 13 17 19
Key concepts
mathloopingconditionals
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now