2008年04月29日
求1到50之間所有偶數的平方值總和
試撰寫一程式,求1到50之間所有偶數的平方值之總和。(15%)
我 coding 好弱,連這個題目都要搞很久,最後才發現是 if 和 for 的大括號沒加這種低級的 bug。有空真的要多寫程式,以免考試的時候要寫卻卡在語法不熟而把分數送他。
引用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
Posted by chiahsien
at 2008年05月6日 18:17
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
Posted by 鳥毅
at 2008年07月28日 11:24
真是不好意思@@
樂多遇到括號就會亂吃字
Posted by Chun
at 2008年07月28日 12:09
