Given a Number N, the task is to find the Remainder when N is divided by R (a two digit Number). The input of the Number may be very large.
Input: N = 13589234356546756, R = 13 Output: 11 Input: N = 3435346456547566345436457867978, R = 17 Output: 13
- Get the digit of N one by one from left to right.
- For each digit, combine with next digit if its less than R.
- If the combination at any point reaches above R, take and store the Remainder.
- Repeat the above steps for all digits from left to right.
Below is the program that implements the above approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Program to find remainder when large number is divided by 11
- Find the remainder when First digit of a number is divided by its Last digit
- Find remainder of array multiplication divided by n
- Find the remainder when N is divided by 4 using Bitwise AND operator
- Largest number less than or equal to Z that leaves a remainder X when divided by Y
- Largest number by which given 3 numbers should be divided such that they leaves same remainder
- Find N % 4 (Remainder with 4) for a large value of N
- Minimum number of operations on a binary string such that it gives 10^A as remainder when divided by 10^B
- Check if a large number can be divided into two or more segments of equal sum
- Check if the remainder of N-1 factorial when divided by N is N-1 or not
- Generate Array whose sum of all K-size subarrays divided by N leaves remainder X
- Count of integers obtained by replacing ? in the given string that give remainder 5 when divided by 13
- Remainder with 7 for large numbers
- Program to find remainder without using modulo or % operator
- Program for quotient and remainder of big number
- Find minimum number to be divided to make a number a perfect square
- Find smallest possible Number from a given large Number with same count of digits
- Find all Factors of Large Perfect Square Natural Number in O(sqrt(sqrt(N))
- Find permutation with maximum remainder Sum
- Find numbers that divide X and Y to produce the same remainder
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.