2008年04月29日

求1到50之間所有偶數的平方值總和

試撰寫一程式,求1到50之間所有偶數的平方值之總和。(15%)

我 coding 好弱,連這個題目都要搞很久,最後才發現是 if 和 for 的大括號沒加這種低級的 bug。有空真的要多寫程式,以免考試的時候要寫卻卡在語法不熟而把分數送他。


Posted by jusofie at 樂多Roodo! │01:01 │回應(7)引用(1)PC閒話
樂多分類:網路/3C 共同主題:Programing 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/5937583
引用列表:
剛好看到:求1到50之間所有偶數的平方值總和,於是順手寫一寫: // // Sum all even in 1~50 // import System sum = 0 for
求1到50之間所有偶數的平方值總和【Thinking more...】 at 2008年05月2日 23:09
回應文章

How about this?

#include
int main(void)
{
int i=0,sum=0;
for (i=2; i
Posted by 大笨蛋 at 2008年05月3日 10:25

大家都很厲害~~
Posted by Chun at 2008年05月3日 12:00
我的 Coding 是一整個弱到像是武功全廢似的,有點概念就去闖盪江湖了。

坦白說,我實在無法接受 Programer 的生活,也因此對 Coding 抱持逃避的態度。
Posted by chiahsien at 2008年05月6日 18:17
以下用C99寫法,請用gcc -std=c99

#include
int main(void)
{
int sum=0;
for(int i=2;i
Posted by 鳥毅 at 2008年07月28日 11:22
#include <stdio.h>
int main(void)
{
int sum=0;
for(int i=2;i<=50; i+=2)
{
sum+=(i*i);
}
printf("\nSum=%d\n", sum);
}
Posted by 鳥毅 at 2008年07月28日 11:23
roodo的留言還真難用呀 Orz
Posted by 鳥毅 at 2008年07月28日 11:24

真是不好意思@@

樂多遇到括號就會亂吃字
Posted by Chun at 2008年07月28日 12:09