c語言大數階乘運算,C語言大數階乘運算

時間 2021-08-11 17:55:48

1樓:看灰過來了

#include

int main()

return 0;}

2樓:匿名使用者

/*1! = 1

2! = 2

3! = 6

4! = 24

5! = 120

6! = 720

7! = 5040

8! = 40320

9! = 362880

10! = 3628800

11! = 39916800

12! = 479001600

13! = 6227020800

14! = 87178291200

15! = 1307674368000

16! = 20922789888000

17! = 355687428096000

18! = 6402373705728000

19! = 121645100408832000

20! = 2432902008176640000

21! = 51090942171709440000

22! = 1124000727777607700000

23! = 25852016738884978000000

24! = 620448401733239410000000

25! = 15511210043330986000000000

26! = 403291461126605650000000000

27! = 10888869450418352000000000000

28! = 304888344611713840000000000000

29! = 8841761993739700800000000000000

30! = 265252859812191030000000000000000

31! = 8222838654177922400000000000000000

32! = 263130836933693520000000000000000000

33! = 8683317618811885900000000000000000000

34! = 295232799039604120000000000000000000000

35! = 10333147966386144000000000000000000000000

36! = 371993326789901180000000000000000000000000

37! = 13763753091226343000000000000000000000000000

38! = 523022617466601040000000000000000000000000000

39! = 20397882081197442000000000000000000000000000000

40! = 815915283247897680000000000000000000000000000000

請按任意鍵繼續. . .

*/#include

double fact(int n)

int main()

3樓:

2012-5-17 23:39 adoqq_bd 方法改進#include

#define n 10000

int main()

; int i,j;

int k=0,l=0;

for(i=1;i<=40;i++)

j=l;

for(;j>=0;j--)

printf("\n");

}return 0;

}每個元素儲存一位算得太慢,也太佔空間。如果需要算更大的數,可以參考

4樓:

剛才剛弄過一個,int陣列每個元素儲存四位數,10000以內的階乘不會有問題

#include

#define n 10000

int main()

; /*用long int 是為了保證16位編譯器也正常*/

int i,j;

int k=0,l=0;

for(i=1;i<=40;i++)

if(k)

j=l;

printf("%d!=%d",i,r[j--]);

for(;j>=0;j--)

printf("\n");

}return 0;

}1!=1

2!=2

3!=6

4!=24

5!=120

6!=720

7!=5040

8!=40320

9!=362880

10!=3628800

11!=39916800

12!=479001600

13!=6227020800

14!=87178291200

15!=1307674368000

16!=20922789888000

17!=355687428096000

18!=6402373705728000

19!=121645100408832000

20!=2432902008176640000

21!=51090942171709440000

22!=1124000727777607680000

23!=25852016738884976640000

24!=620448401733239439360000

25!=15511210043330985984000000

26!=403291461126605635584000000

27!=10888869450418352160768000000

28!=304888344611713860501504000000

29!=8841761993739701954543616000000

30!=265252859812191058636308480000000

31!=8222838654177922817725562880000000

32!=263130836933693530167218012160000000

33!=8683317618811886495518194401280000000

34!=295232799039604140847618609643520000000

35!=10333147966386144929666651337523200000000

36!=371993326789901217467999448150835200000000

37!=13763753091226345046315979581580902400000000

38!=523022617466601111760007224100074291200000000

39!=20397882081197443358640281739902897356800000000

40!=815915283247897734345611269596115894272000000000

請按任意鍵繼續. . .

c語言大數加法,C語言大數加法。

include include void main flag 0 c 存放結果,flag 進位資訊 int i,j,k,m,n,len i 跟蹤a的下標,j 跟蹤b的下標,k 跟蹤c的下標 scanf s s a,b m strlen a n strlen b len m n m n 相加時,先將右...

c語言程式設計n的階乘,C語言程式設計 N的階乘

高寵 小霸王 include include stdio.h int input int min,int max void main j for i 2569 s i len if n m printf d n else printf a d d n,m if len 20 for i len 1 ...

用c語言怎麼寫1到5的階乘的和,c語言1階乘 3階乘 5階乘程式怎麼寫?

娛樂小八卦啊 如下 define crt secure no warnings 1 include stdio.h include stdlib.h int main int n 0 printf 請輸入一個數字 scanf d n int i 0 int ret 1 int sum 0 for i...