Given a integer as a input and replace all the ‘0’ with ‘5’ in the integer.
102 - 152 1020 - 1525
Use of array to store all digits is not allowed.
The idea is simple, we get the last digit using mod operator ‘%’. If the digit is 0, we replace it with 5, otherwise keep it as it is. Then we recur for remaining digits.
Following is C implementation of the above idea.
This article is contributed by Sai Kiran. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Square root of an integer
- Program to add two polynomials
- Calculate the angle between hour hand and minute hand
- A Boolean Matrix Question
- Birthday Paradox
- Sort first k values in ascending order and remaining n-k values in descending order
- Count pairs in a sorted array whose product is less than k
- Count number of triplets with product equal to given number | Set 2
- Fascinating Number
- Sum of bitwise OR of all subarrays