#933: 急!急需求助的C題目


axillary1351 (小六)

學校 : 中華大學
編號 : 2789
來源 : [118.169.103.20]
最後登入時間 :
2008-11-15 01:22:27
. Unfinished! | From: [118.169.103.20] | 發表日期 : 2008-11-15 01:23

有C的高手能幫我寫這2個題目嗎?
[color=red]檔案類型要C不是C++的[/color][quote]
第一題
Write a program that Calculate the value of a cosine function.
題目內容
1.Read the radian x of an angle and an integer n.
2.Approximate cosine of x by using the following formula.
3.Print the value produced by C library and calculated by the above formula.
[img]http://ecampus.chu.edu.tw/eCampus/Learn/Storehouse/HtmlContent/22/74C22922/Image/cosine.png[/img]
A possible run may look like:
Enter x, n: 2 10
cos(2.0000) = -0.41614683654714240690 (calculated by the C's math library)
cos(2.0000) = -0.41614683654713868766 (calculated by the approximation)

Enter x, n: 2 100
cos(2.0000) = -0.41614683654714240690 (calculated by the C's math library)
cos(2.0000) = -0.41614683654714240690 (calculated by the approximation)
[/quote]

[quote]
第二題
An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number.
For example, 6 is a perfect number because 6 = 1 + 2 + 3.
題目內容
1.Read an integer n.
2.Print all perfect numbers between 1 and n.
3.Calculate the sum of all perfect numbers between 1 and n.

A possible run may look like:
Input n: 30
The perfect numbers between 1 and 30 are:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
The sum of all perfect numbers between 1 and 30 is 34.

[/quote]

麻煩了
如果有空也希望能幫我解釋一下題目的意思
最近快被迴圈搞瘋了
這很急,拜託各位大大了~

 
ZeroJudge Forum