Given a number N, the task is to find the sum of digits of a number at even and odd places.
Input: N = 54873
Sum odd = 16
Sum even = 11
Input: N = 457892
Sum odd = 20
Sum even = 15
- First, calculate the reverse of the given number.
- To the reverse number we apply modulus operator and extract its last digit which is actually the first digit of a number so it is odd positioned digit.
- The next digit will be even positioned digit, and we can take the sum in alternating turns.
Below is the implementation of the above approach:
Sum odd = 20 Sum even = 15
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Primality test for the sum of digits at odd places of a number
- Check whether sum of digits at odd places of a number is divisible by K
- Check whether product of digits at even places of a number is divisible by K
- Check if product of digits of a number at even and odd places is equal
- Find smallest number with given number of digits and sum of digits
- Find the Largest number with given number of digits and sum of digits
- Find the smallest number whose digits multiply to a given number n
- Find count of digits in a number that divide the number
- Find maximum number that can be formed using digits of a given number
- Find first and last digits of a number
- Given a number n, find the first k digits of n^n
- Find M-th number whose repeated sum of digits of a number is N
- Find next greater number with same set of digits
- Find a Number X whose sum with its digits is equal to N
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.