Home > Back-end >  Urgent for this code where is wrong?
Urgent for this code where is wrong?

Time:11-02

#include
#include
#include
# define MAXSIZE 200
//used to calculate the first number is not zero in the bigint (highest) position (subscript)
Int mark_bigint (int bigint [])
{
Int mark;
For (mark=MAXSIZE - 1; Mark & gt;=0; Mark -)
{
If (bigint [mark]==0) break;
}
Return mark;
}
Int main (void)
{
Int bigint1 [MAXSIZE]=,0,9,8,7,6,5,4,3,2,1 {0};
//used to store large integer 1 integer array, the big integer values for: 12345678900
6,7,1,2,9,8,9,6,8,2,7,8,9,1,2 int bigint2 [MAXSIZE]={};
//used to store 2 an integer array of big integer, this big integer values for: 219872869892176
Int bigint3 [MAXSIZE + 1];
//used to store the results of large integer arithmetic integer array
Int k, I, mark1, mark2, mark3, mark;
Mark1=mark_bigint (bigint1);
//the first number is not zero in computing bigint1 (highest) where the subscript
Mark2=mark_bigint (bigint2);
//the first number is not zero in computing bigint2 (highest) where the subscript
Mark=mark1 & gt; Mark2? Mark1: mark2;
//take digits long that big integer highest subscript

K=0;
While (k & lt;=mark)//big integer from low to high in turn add
{
Bigint3 [k]=bigint3 bigint1 [k] + [k] + bigint2 [k].
If (bigint3 [k] & gt; 10)//carry handle
{
Bigint3 [k + 1] + +;
Bigint3 [k]=bigint3 [k] - 10;
}
k++;
}
Mark3=mark_bigint (bigint3);
//the first number is not zero in computing bigint3 (highest) where the subscript
Printf (" adding results: \ n ");
For (I=MAXSIZE - 1; I & gt;=0; I -)//output together the results
Printf (" % d ", bigint3 [I]);
Putchar (" \ n ");
return 0;
}

CodePudding user response:

Don't say anything wrong...
  • Related