發新話題
打印

[C Other3]問題Q2

[C Other3]問題Q2

Write a program that calculates and prints the sum of the even integers from 2 to 30." [5 f/ O' Q" Q' f
Output: 9 f& m, D% m' _, M. L* F2 [
Sum of the even integers from 2 to 30 is: 240.

TOP

[C Other3]問題Q2

問題沒有要求用戶事入數據,故我的試驗如下: ----------------- #include void main() { int num, total; total = 0; for (num = 2; num <= 30; num = num + 2) { total = total + num; } printf("Sum of the even integers from 2 to 30 is: %d\n", total); }

TOP

引用:
原帖由 a8d2ljf 於 19-4-2008 20:30 發表 性病治? 性病症? 梅毒治? ?疹治? ?疣治?
請用文字回覆填寫!...謝謝
否則當惡意灌水!

TOP

發新話題
eXTReMe Tracker