Combines two or more numbers into a single number
Answers
Answered by
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
Math,
7 months ago
Math,
7 months ago
Geography,
1 year ago
Science,
1 year ago
Social Sciences,
1 year ago