#include <math.h>#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include "include/bignum.h"int VERBATIM = 1;int STDIN = 0;int MAX_BYTES_READ = 904857; // Use maximum ~8.6 MB of memory for storing a number.bignum a, b, d, e;int main ( int argc, char *argv[ ] ) { char *nvalue = NULL; char cin[MAX_BYTES_READ]; int index, c, prime = 0, ds = 0; //opterr = 0; int_to_bignum( 10, &e ); int_to_bignum( 0, &a ); int_to_bignum( 0, &b ); int_to_bignum( 0, &d ); //unsigned long long int i = 1; int t = 0; char ch; if (VERBATIM) printf( "Converting number to bignum, be patient..." ); while( 1 ) { ch = getc( stdin ); if ( ch == EOF ) break; t = atoi( &ch ); ds += t; int_to_bignum( t, &b ); add_bignum( &a, &b, &d ); multiply_bignum( &d, &e, &a ); } // Divide a with ten, since the second last byte in stdin gets added, which is an extra zero. // divide_bignum() has to be called twice for some reason, the first call doesn't do anything. divide_bignum( &a, &e, &d ); divide_bignum( &d, &e, &a ); return EXIT_SUCCESS;}