Math, asked by sahed8635, 1 year ago

Combines two or more numbers into a single number

Answers

Answered by asifkuet
1

Answer:

You could change the numbers into Strings, concatenate them and adapt the result back into an integer.

For Example:

int n1 = 12345;

int n2 = 67890;

String concat = Integer.toString(n1) + Integer.toString(n2);

int combined = Integer.parseInt(concat);

Another Approach:

Code:

int glue( int a, int b )

{

 int d;

 for( d=1; b/d; d*=10 );

 return a*d + b;

}

Similar questions