Given two integers n1 and n2, the task is to concatenate these two integers into one integer.
Input: n1 = 12, n2 = 34 Output: 1234 Input: n1 = 1, n2 = 93 Output: 193
Approach: The simplest approach to do this is:
- Convert both numbers to string
- Concatenate both strings into one, as this is comparatively easy
- Convert this concatenated string back to integer
- Program to Convert Set of Integer to Array of Integer in Java
- C++ program to concatenate a string given number of times
- TCS Coding Practice Question | Concatenate 2 Strings
- Find minimum possible values of A, B and C when two of the (A + B), (A + C) and (B + C) are given
- How to Read and Print an Integer value in C++
- How to Read and Print an Integer value in C
- Count even and odd digits in an Integer
- Returning Multiple values in Java
- Default array values in Java
- Print intermediate values in an array
- String to Integer in Java - parseInt()
- Count the number of holes in an integer
- Find the missing integer in an array if mean is given
- How to Read and Print an Integer value in Java
- Generate all unique partitions of an integer | Set 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.