--------------------
閱讀本主題的最佳解答--------------------
An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5, and 7 are prime, but 4, 6, 8 and 9 are not.
1. Write a function that receives a number from the main function and determines if the number is prime.
2.Write the main function that
(a.)reads an integer n and uses the above function to determine and print all the prime numbers between 1 and n.
(b.)calulates the sum of all prime numbers between 1 and n.
A possibe run may look like:
Enter the number: 10
The prime numbers between 1 and 10 are:
2
3
5
7
The sum is 17.
Enter the number: 50
The prime numbers between 1 and 100 are:
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
The sum is 328.
可以參考一下嗎..........