|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
Given one integers N. Please Write a C program to print out all the prime numbers between 2 and N (Included 2 and N, if N is a prime number).
Hint: You may need an array to store prime numbers that you found.
Input
One integer N.
Note that:
- 32,767 >= N >= 2.
Output
Output should follow below format:
P1 P2 P3 P4 … Pn
Note that:
- Need to have a return value('\n') at the end of your string.
- P1 ~ Pn are all prime numbers between 2 and N.
- P1 ~ Pn should be arranged in ascending power. That means, Pn > … > P4 > P3 > P2 > P1.
Tags