Given a number x and two digits d1 and d2, replace d1 with d2 in x.
Input : x = 645, d1 = 6, d2 = 5 Output : 545 We replace digit 6 with 5 in number 645. Input : x = 746, d1 = 7, d2 = 8 Output : 846
We traverse through all digits of x. For every digit, we check if it is d1, we update result accordingly.
- Program to delete Nth digit of a Number
- Program to find the last digit of X in base Y
- Program to find last digit of n'th Fibonnaci Number
- C++ Program for Smallest K digit number divisible by X
- C++ Program for Largest K digit number divisible by X
- Java Program for Smallest K digit number divisible by X
- Java Program for Largest K digit number divisible by X
- Count of Numbers in Range where first digit is equal to last digit of the number
- Find the remainder when First digit of a number is divided by its Last digit
- Count of integers obtained by replacing ? in the given string that give remainder 5 when divided by 13
- Count 'd' digit positive integers with 0 as a digit
- Largest number less than N with digit sum greater than the digit sum of N
- Check if frequency of each digit is less than the digit
- Count n digit numbers not having a particular digit
- Maximize the given number by replacing a segment of digits with the alternate digits given
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.