Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

問個簡單的問題

0 views
Skip to first unread message

小火輪

unread,
Mar 31, 2003, 11:08:11 AM3/31/03
to
==> Maste...@kkcity.com.tw (月光魔法師) 提到:
: ※ 引述《elichris (呼吸的感覺)》之銘言:
: > 這是階層問題,可以用Recursive來解決
: > int Factory(int n)
: > {
: > if(n == 1)
: > return 1;
: > else
: > return n * Factory(n - 1);
: > }
: > 當然要注意傳回值是否大於你的return type可以接受的範圍,
: > 如果是這樣子,你就要用其他型態來接用算結果,
: > 或是自己定義一個數值型態,如128bit(或更大)的數值型態.
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 沒什麼好考慮的....1000!肯定爆漿....~_~
: 1000!約2576位數....那個內建型態接的起來??
#include<stdio.h>

int a,b;
int sum=0;

void main()
{

for(a=1;a<500;a++){

for(b=999;b>500;b--){

sum=1000*(1000-a)*(1000-b);
}
}
printf("The average is %i\n",sum);
}

我降寫對嗎

--
◎ [1;31m龍 [32m貓 [33m資 [34m訊 [35m天 [36m地 [0m( [1mbbs.mgt.ncu.edu.tw [0m)
◎[ [1;33;46mkiesheme [0m]From: 210.60.31.234

追憶似水年華

unread,
Mar 31, 2003, 12:22:18 PM3/31/03
to
※ 引述《kieshe...@bbs.mgt.ncu.edu.tw (小火輪)》之銘言:
> ==> Maste...@kkcity.com.tw (月光魔法師) 提到:

> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : 沒什麼好考慮的....1000!肯定爆漿....~_~
> : 1000!約2576位數....那個內建型態接的起來??
> #include<stdio.h>
> int a,b;
> int sum=0;
> void main()
> {
> for(a=1;a<500;a++){
> for(b=999;b>500;b--){
> sum=1000*(1000-a)*(1000-b);
> }
> }
> printf("The average is %i\n",sum);
> }
> 我降寫對嗎

不用看.....還是給零分....:P

http://ehome.hifly.to/forumdisplay.php?s=3ef88b599c10239771e68eb72cf207bc&forumid=53
去看吧....
--

[1;33;41m[Master Chang.]______________________________________________ [m
[1;33;44m企鵝寶寶工作隊 | http://3ybaby.v-club.net/ [m
[1;33;44m請大家幫忙翻譯KDE | http://i18n.linux.org.tw/ [m
[1;33;44m全像光學實驗室 | http://www.ccit.edu.tw/~c3hog/master.html [m
[1;33;44m_____________________________________________________________ [m
--
[1;32m※ Origin: [33mSayYA 資訊站 [37m<bbs.sayya.org> [m
[1;31m◆ From: [36mh112-213.dorm5.ccit.edu.tw [m

0 new messages