Given two integers a and b. The task is to concatenate these two integers into one integer.
Input : a = 806, b = 91 Output : 80691 Input : a = 5, b = 1091 Output : 51091
Method 1: One method of achieving this can be counting the number of digits of second number. Then multiply the first number with 10^digits and adding both the numbers. Below is the implementation.
Method 2: Another method can be converting both the numbers to the string. Then concatenate them and convert them back to integers. Below is the implementation.
- Python - Concatenate Dictionary string values
- Python - Concatenate values with same keys in a list of dictionaries
- Python - Concatenate String values in Dictionary List
- How to Concatenate Column Values in Pandas DataFrame?
- Python | Ways to convert Boolean values to integer
- Python Program to Count set bits in an integer
- Python program to find the highest 3 values in a dictionary
- Python program to Swap Keys and Values in Dictionary
- Python program to fetch the indices of true values in a Boolean list
- Program to print all distinct elements of a given integer array in Python | Ordered Dictionary
- Python program to Count Uppercase, Lowercase, special character and numeric values using Regex
- Python | Concatenate All Records
- Python | Ways to concatenate tuples
- Python | Concatenate dictionary value lists
- numpy.concatenate() function | Python
- Python | Numpy np.ma.concatenate() method
- Python | Ways to concatenate two lists
- Python | Ways to concatenate boolean to string
- Python | Concatenate two lists element-wise
- Python | Pandas Series.str.cat() to concatenate string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.
Improved By : riturajsaha