このプログラムを参考にして、200の階乗を計算するプログラムを作る。
#include <stdio.h>
#include <stdlib.h>
int
main()
{
int a[ 1000 ];
int i;
int j;
int c;
for ( j = 0; j < 1000; j++ ) a[ j ] = 0;
a[ 0 ] = 1;
for ( i = 0; i < 1000; i++ ){
c = 0;
for( j = 0; j < 1000; j++ ){
a[ j ] = a[ j ] * 2 + c;
if ( a[ j ] >= 20 ){
a[ j ] = a[ j ] - 20;
c = 2;
} else if ( a[ j ] >= 10 ){
a[ j ] = a[ j ] - 10;
c = 1;
} else {
c = 0;
} /* if */
} /* for */
} /* for */
for ( j = 999; j >= 0; j-- ) printf( "%1d", a[ j ] );
printf( "\n" );
return ( 0 );
} /* main */