Given two integer ‘N’ and ‘K’, the task is to find the sum of digits of ‘N’ at it’s odd places (right to left) and check whether the sum is divisible by ‘K’. If it is divisible, output YES, otherwise output NO.
Input: N = 4325, K = 4
Since, 3 + 5 = 8, which is divisible by 4.
Input: N = 1209, K = 3
- Find the sum of the digits of ‘N’ at odd places (right to left).
- Then check the divisibility of the sum by taking it’s modulo with ‘K’.
- If it is divisible then output ‘YES’, otherwise output ‘NO’.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- 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
- Primality test for the sum of digits at odd places of a number
- Find the sum of digits of a number at even and odd places
- Count of numbers in range which are divisible by M and have digit D at odd places
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Check if the sum of digits of number is divisible by all of its digits
- Number formed by deleting digits such that sum of the digits becomes even and the number odd
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Arrangement of the characters of a word such that all vowels are at odd places
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- Program to check if a number is divisible by sum of its digits
- Check whether factorial of N is divisible by sum of first N natural numbers
- To check whether a large number is divisible by 7
- Check whether a large number is divisible by 53 or not
- Smallest number with given sum of digits and sum of square of digits
- Check whether a given number is even or odd
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.