HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


50904 - Print All Prime Numbers

Section problems

• 50962 - Find the Character
• 50974 - Area of the circle
• 50905 - Convert KPH to MPH
• 50967 - Finding Square Roots
• 50960 - Number of Heart Beats
• 50953 - ASCII Codes - Reverse
• 50885 - Calculate the Average
• 50887 - Average of Test Scores
• 50904 - Print All Prime Numbers
• 50895 - Hours Minutes and Seconds
• 50902 - Translate Score into Grade
• 50938 - Translate Score into Grade
• 50890 - Convert Celsius to Fahrenheit
• 50958 - Number of Passengers in Train
• 50889 - Convert to Minutes and Sec...
• 50952 - Print All Numbers from N d...
• 50900 - Put the Numbers in Descend...

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