HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


50904 - Print All Prime Numbers

Volume problems

• 50862 - Sum of the Pairs
• 50904 - Print All Prime Numbers
• 50911 - Symmetric Array
• 51003 - Double Prime
• 50935 - Max Discount
• 50838 - Balanced Numbers
• 50851 - Repeated Numbers
• 50916 - Ascending Numbers
• 50724 - Number of Circles
• 50926 - School Mail Merge

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