{"id":"fc66fafa-856c-41cb-a5d7-4727838a1ca5","name":"Print All Primes Till N","description":"1. You've to print all prime numbers between a range. \r\n2. Take as input \"low\", the lower limit of range.\r\n3. Take as input \"high\", the higher limit of range.\r\n4. For the range print all the primes numbers between low and high (both included).","inputFormat":"low \r\nhigh","outputFormat":"n1\r\nn2\r\n.. all primes between low and high (both included)","constraints":"2 &lt;= low &lt; high &lt; 10 ^ 6","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int argc, char **argv){\r\n int low, high;\r\n cin >> low >> high;\r\n\r\n //write your code here\r\n\r\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n public static void main(String[] args) {\r\n // write your code here\r\n }\r\n}"},"python":{"code":"low=int(input())\nhigh=int(input())\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"6 \r\n24","sampleOutput":"7\r\n11\r\n13\r\n17\r\n19\r\n23","questionVideo":"https://www.youtube.com/embed/sVdGn8xfCCM","hints":[],"associated":[{"id":"0f5c961c-f465-4956-80b0-3226715845e7","name":"Can you solve Print All Primes Till N using Recursion ?","slug":"can-you-solve-print-all-primes-till-n-using-recursion","type":4},{"id":"285d3abc-80a5-40b6-9f0c-b0b7f3a1a158","name":"what will be the output , if low = 2 and high = 3 (Analyze the code) ?","slug":"what-will-be-the-output-if-low-2-and-high-3-analyze-the-code","type":4},{"id":"3d5b2e9f-42bd-4359-87ad-e2a7a04c3f8b","name":"while checking a number is prime or not , wil there be any change in time complexity for \"87\" if we loop till (n-1) i.e 86 instead of \" Sqaure root of 87 \" ?","slug":"while-checking-a-number-is-prime-or-not-wil-there-be-any-change-in-time-complexity-for-87-if-we-loop-till-n-1-i-e-86-instead-of-sqaure-root-of-87","type":4},{"id":"3f9537ee-dc77-4d10-aeff-09cda0f3accf","name":"What will be the output of given input?","slug":"what-will-be-the-output-of-given-input","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"e98263a6-9041-418a-8c09-e5f78d870825","name":"Print All Primes Till N","slug":"print-all-primes-till-n","type":1}],"next":{"id":"f27238c2-627f-496e-a8d6-4658efcb423f","name":"Primes Till N","type":3,"slug":"primes-till-n"},"prev":{"id":"38a6c0ce-7eda-43f3-ab44-a356e0cbafdc","name":"Is a Number Prime?","type":3,"slug":"is-a-number-prime"}}}

Print All Primes Till N

1. You've to print all prime numbers between a range. 2. Take as input "low", the lower limit of range. 3. Take as input "high", the higher limit of range. 4. For the range print all the primes numbers between low and high (both included).

{"id":"fc66fafa-856c-41cb-a5d7-4727838a1ca5","name":"Print All Primes Till N","description":"1. You've to print all prime numbers between a range. \r\n2. Take as input \"low\", the lower limit of range.\r\n3. Take as input \"high\", the higher limit of range.\r\n4. For the range print all the primes numbers between low and high (both included).","inputFormat":"low \r\nhigh","outputFormat":"n1\r\nn2\r\n.. all primes between low and high (both included)","constraints":"2 &lt;= low &lt; high &lt; 10 ^ 6","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int argc, char **argv){\r\n int low, high;\r\n cin >> low >> high;\r\n\r\n //write your code here\r\n\r\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n public static void main(String[] args) {\r\n // write your code here\r\n }\r\n}"},"python":{"code":"low=int(input())\nhigh=int(input())\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"6 \r\n24","sampleOutput":"7\r\n11\r\n13\r\n17\r\n19\r\n23","questionVideo":"https://www.youtube.com/embed/sVdGn8xfCCM","hints":[],"associated":[{"id":"0f5c961c-f465-4956-80b0-3226715845e7","name":"Can you solve Print All Primes Till N using Recursion ?","slug":"can-you-solve-print-all-primes-till-n-using-recursion","type":4},{"id":"285d3abc-80a5-40b6-9f0c-b0b7f3a1a158","name":"what will be the output , if low = 2 and high = 3 (Analyze the code) ?","slug":"what-will-be-the-output-if-low-2-and-high-3-analyze-the-code","type":4},{"id":"3d5b2e9f-42bd-4359-87ad-e2a7a04c3f8b","name":"while checking a number is prime or not , wil there be any change in time complexity for \"87\" if we loop till (n-1) i.e 86 instead of \" Sqaure root of 87 \" ?","slug":"while-checking-a-number-is-prime-or-not-wil-there-be-any-change-in-time-complexity-for-87-if-we-loop-till-n-1-i-e-86-instead-of-sqaure-root-of-87","type":4},{"id":"3f9537ee-dc77-4d10-aeff-09cda0f3accf","name":"What will be the output of given input?","slug":"what-will-be-the-output-of-given-input","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"e98263a6-9041-418a-8c09-e5f78d870825","name":"Print All Primes Till N","slug":"print-all-primes-till-n","type":1}],"next":{"id":"f27238c2-627f-496e-a8d6-4658efcb423f","name":"Primes Till N","type":3,"slug":"primes-till-n"},"prev":{"id":"38a6c0ce-7eda-43f3-ab44-a356e0cbafdc","name":"Is a Number Prime?","type":3,"slug":"is-a-number-prime"}}}
plane

Editor


Loading...

Print All Primes Till N

easy

1. You've to print all prime numbers between a range. 2. Take as input "low", the lower limit of range. 3. Take as input "high", the higher limit of range. 4. For the range print all the primes numbers between low and high (both included).

Constraints

2 <= low < high < 10 ^ 6

Format

Input

low high

Output

n1 n2 .. all primes between low and high (both included)

Example

Sample Input

6 24

Sample Output

7 11 13 17 19 23

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode