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
- Python - Concatenate Ranged Values in String list
- How to Concatenate Column Values in Pandas DataFrame?
- Python | Ways to concatenate two lists
- Python | Concatenate two lists element-wise
- Concatenate two strings using Operator Overloading in Python
- Python program to Concatenate Kth index words of String
- Python program to concatenate Strings around K
- Concatenate two columns of Pandas dataframe
- How to Concatenate two 2-dimensional NumPy Arrays?
- Python | Pandas Series.str.cat() to concatenate string
- Python | Merge, Join and Concatenate DataFrames using Panda
- Python | Ways to concatenate boolean to string
- Python | Concatenate dictionary value lists
- Python | Ways to concatenate tuples
- Python | Numpy np.ma.concatenate() method
- Python | How to Concatenate tuples to nested tuples
- Python | Concatenate N consecutive elements in String list
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