fork download
  1. #include <stdio.h>
  2. void power3(unsigned long result[]);
  3. void print_result(unsigned long result[]);
  4. int main(void){
  5. unsigned long result[8]={1,0,0,0,0,0,0,0};
  6.  
  7. for(int i=1;i<=99;i++)
  8. {
  9. power3(result);
  10. print_result(result);
  11. }
  12. return 0;
  13. }
  14.  
  15. void power3(unsigned long result[])
  16. {
  17. int carry=0;
  18. for(int u=0;u<=7;u++)
  19. {
  20. int w;
  21. w=3*result[u];
  22. w=w+carry;
  23. carry=w/1000000;
  24. result[u]=w-(carry*1000000);
  25.  
  26. }
  27. }
  28.  
  29. void print_result(unsigned long result[ ])
  30. {
  31. static int n=1;
  32. printf("n=%3d:",n);
  33.  
  34.  
  35. for(int t=7;t>=0;t--)
  36. printf("%7lu ",result[t]);
  37. printf("\n");
  38. n++;
  39. }
  40.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
n=  1:      0       0       0       0       0       0       0       3 
n=  2:      0       0       0       0       0       0       0       9 
n=  3:      0       0       0       0       0       0       0      27 
n=  4:      0       0       0       0       0       0       0      81 
n=  5:      0       0       0       0       0       0       0     243 
n=  6:      0       0       0       0       0       0       0     729 
n=  7:      0       0       0       0       0       0       0    2187 
n=  8:      0       0       0       0       0       0       0    6561 
n=  9:      0       0       0       0       0       0       0   19683 
n= 10:      0       0       0       0       0       0       0   59049 
n= 11:      0       0       0       0       0       0       0  177147 
n= 12:      0       0       0       0       0       0       0  531441 
n= 13:      0       0       0       0       0       0       1  594323 
n= 14:      0       0       0       0       0       0       4  782969 
n= 15:      0       0       0       0       0       0      14  348907 
n= 16:      0       0       0       0       0       0      43   46721 
n= 17:      0       0       0       0       0       0     129  140163 
n= 18:      0       0       0       0       0       0     387  420489 
n= 19:      0       0       0       0       0       0    1162  261467 
n= 20:      0       0       0       0       0       0    3486  784401 
n= 21:      0       0       0       0       0       0   10460  353203 
n= 22:      0       0       0       0       0       0   31381   59609 
n= 23:      0       0       0       0       0       0   94143  178827 
n= 24:      0       0       0       0       0       0  282429  536481 
n= 25:      0       0       0       0       0       0  847288  609443 
n= 26:      0       0       0       0       0       2  541865  828329 
n= 27:      0       0       0       0       0       7  625597  484987 
n= 28:      0       0       0       0       0      22  876792  454961 
n= 29:      0       0       0       0       0      68  630377  364883 
n= 30:      0       0       0       0       0     205  891132   94649 
n= 31:      0       0       0       0       0     617  673396  283947 
n= 32:      0       0       0       0       0    1853   20188  851841 
n= 33:      0       0       0       0       0    5559   60566  555523 
n= 34:      0       0       0       0       0   16677  181699  666569 
n= 35:      0       0       0       0       0   50031  545098  999707 
n= 36:      0       0       0       0       0  150094  635296  999121 
n= 37:      0       0       0       0       0  450283  905890  997363 
n= 38:      0       0       0       0       1  350851  717672  992089 
n= 39:      0       0       0       0       4   52555  153018  976267 
n= 40:      0       0       0       0      12  157665  459056  928801 
n= 41:      0       0       0       0      36  472996  377170  786403 
n= 42:      0       0       0       0     109  418989  131512  359209 
n= 43:      0       0       0       0     328  256967  394537   77627 
n= 44:      0       0       0       0     984  770902  183611  232881 
n= 45:      0       0       0       0    2954  312706  550833  698643 
n= 46:      0       0       0       0    8862  938119  652501   95929 
n= 47:      0       0       0       0   26588  814358  957503  287787 
n= 48:      0       0       0       0   79766  443076  872509  863361 
n= 49:      0       0       0       0  239299  329230  617529  590083 
n= 50:      0       0       0       0  717897  987691  852588  770249 
n= 51:      0       0       0       2  153693  963075  557766  310747 
n= 52:      0       0       0       6  461081  889226  673298  932241 
n= 53:      0       0       0      19  383245  667680   19896  796723 
n= 54:      0       0       0      58  149737    3040   59690  390169 
n= 55:      0       0       0     174  449211    9120  179071  170507 
n= 56:      0       0       0     523  347633   27360  537213  511521 
n= 57:      0       0       0    1570   42899   82081  611640  534563 
n= 58:      0       0       0    4710  128697  246244  834921  603689 
n= 59:      0       0       0   14130  386091  738734  504764  811067 
n= 60:      0       0       0   42391  158275  216203  514294  433201 
n= 61:      0       0       0  127173  474825  648610  542883  299603 
n= 62:      0       0       0  381520  424476  945831  628649  898809 
n= 63:      0       0       1  144561  273430  837494  885949  696427 
n= 64:      0       0       3  433683  820292  512484  657849   89281 
n= 65:      0       0      10  301051  460877  537453  973547  267843 
n= 66:      0       0      30  903154  382632  612361  920641  803529 
n= 67:      0       0      92  709463  147897  837085  761925  410587 
n= 68:      0       0     278  128389  443693  511257  285776  231761 
n= 69:      0       0     834  385168  331080  533771  857328  695283 
n= 70:      0       0    2503  155504  993241  601315  571986   85849 
n= 71:      0       0    7509  466514  979724  803946  715958  257547 
n= 72:      0       0   22528  399544  939174  411840  147874  772641 
n= 73:      0       0   67585  198634  817523  235520  443624  317923 
n= 74:      0       0  202755  595904  452569  706561  330872  953769 
n= 75:      0       0  608266  787713  357709  119683  992618  861307 
n= 76:      0       1  824800  363140   73127  359051  977856  583921 
n= 77:      0       5  474401   89420  219382   77155  933569  751763 
n= 78:      0      16  423203  268260  658146  231467  800709  255289 
n= 79:      0      49  269609  804781  974438  694403  402127  765867 
n= 80:      0     147  808829  414345  923316   83210  206383  297601 
n= 81:      0     443  426488  243037  769948  249630  619149  892803 
n= 82:      0    1330  279464  729113  309844  748891  857449  678409 
n= 83:      0    3990  838394  187339  929534  246675  572349   35227 
n= 84:      0   11972  515182  562019  788602  740026  717047  105681 
n= 85:      0   35917  545547  686059  365808  220080  151141  317043 
n= 86:      0  107752  636643   58178   97424  660240  453423  951129 
n= 87:      0  323257  909929  174534  292273  980721  360271  853387 
n= 88:      0  969773  729787  523602  876821  942164   80815  560161 
n= 89:      2  909321  189362  570808  630465  826492  242446  680483 
n= 90:      8  727963  568087  712425  891397  479476  727340   41449 
n= 91:     26  183890  704263  137277  674192  438430  182020  124347 
n= 92:     78  551672  112789  411833   22577  315290  546060  373041 
n= 93:    235  655016  338368  235499   67731  945871  638181  119123 
n= 94:    706  965049   15104  706497  203195  837614  914543  357369 
n= 95:   2120  895147   45314  119491  609587  512844  743630   72107 
n= 96:   6362  685441  135942  358474  828762  538534  230890  216321 
n= 97:  19088   56323  407827   75424  486287  615602  692670  648963 
n= 98:  57264  168970  223481  226273  458862  846808   78011  946889 
n= 99: 171792  506910  670443  678820  376588  540424  234035  840667