HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


50904 - Print All Prime Numbers

Volume problems

• 50862 - Sum of the Pairs
• 50904 - Print All Prime Numbers
• 50307 - Palindromes
• 50305 - John's Tasks
• 50315 - Pig Latin
• 50911 - Symmetric Array
• 50296 - Total Discount Rate
• 50935 - Max Discount
• 50851 - Repeated Numbers
• 50838 - Balanced Numbers

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