史萊姆論壇

返回   史萊姆論壇 > 專業主討論區 > 程式語言討論區
忘記密碼?
論壇說明

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』

Google 提供的廣告


 
 
主題工具 顯示模式
舊 2007-11-09, 05:18 PM   #1
rang0419
註冊會員
榮譽勳章

勳章總數
UID - 285008
在線等級: 級別:0 | 在線時長:4小時 | 升級還需:1小時
註冊日期: 2007-11-07
文章: 24
精華: 0
現金: 35 金幣
資產: 35 金幣
預設 疑問 - 請問該如何用C寫呢??



--------------------
閱讀本主題的最佳解答
--------------------


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.


可以參考一下嗎..........
rang0419 目前離線  
送花文章: 5, 收花文章: 0 篇, 收花: 0 次
回覆時引用此帖
 



發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用

相似的主題
主題 主題作者 討論區 回覆 最後發表
求助 - 請問該如何移除語言套件 vt9 Windows 10 各種疑難討論專區 2 2007-03-26 11:00 PM
請問:該如何擷取遊戲的畫面? john0720 一般電腦疑難討論區 2 2004-01-27 02:23 PM
請問兩台電腦該如何用分享呢??? a791004 一般電腦疑難討論區 7 2003-07-20 01:23 AM
請問該如何使用低階格式化? oya999 軟體應用問題討論區 1 2003-05-01 12:25 AM


所有時間均為台北時間。現在的時間是 04:11 AM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1