Idea: If you want to truncate an even integer into two new integers, you need to find the total length of this number first, assuming the length is 2n. Then the first n is the first integer, which can be obtained by dividing the original integer by the n power of 10; The last n bit is the second integer, which can be obtained by dividing the original integer by the n power of 10.
Reference code:
# include & ltstring.h & gt
# include & ltstdio.h & gt
# include & ltmath.h & gt
int fun(int a){
int n = 0;
while(a){
n++;
a/= 10;
}
Returns n/2;
}
int main()
{
int a,n,t;
scanf("%d ",& ampa);
n = fun(a);
t=(int)pow( 10,n);
printf("%d %d ",a/t,a % t);
Returns 0;
}
/*
Output:
12345678
1234 5678
*/