HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


50240 - Print All Prime Numbers

Section problems

• 50230 - ASCII Codes
• 50231 - Hours Minutes and Seconds
• 50233 - Prime Number
• 50234 - Draw the Pattern
• 50235 - How Many Years
• 50236 - Put the Numbers in Descend...
• 50237 - Sum of Cubes-1
• 50238 - Translate Score into Grade
• 50240 - Print All Prime Numbers
• 50241 - Convert KPH to MPH
• 50242 - Second Largest
• 50244 - Manhattan Distance
• 50250 - Shifting rows and columns
• 50251 - Sum of the Biggest Neighbors
• 50254 - Divisible by 3
• 50255 - Gaussian Elimination
• 50260 - The Most Crowded Station

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

Print All Prime Numbers

Write a program that prints all prime numbers from 2 to N (N is included.).

Input: A positive integer N (N>1).

Output: List of prime numbers from 2 to N with a space in between them.

Sample Input1:

Sample Input2:

6

29

Sample  Output1:

Sample  Output2:

2 3 5

2 3 5 7 11 13 17 19 23 29

 

Для отправки решений необходимо выполнить вход.

www.contester.ru