Given a number N and numbers of digits in N, the task is to check whether the product of digits at even places of a number is divisible by sum of digits at odd place. If it is divisible, output “TRUE” otherwise output “FALSE”.
Input: N = 2157 Output: TRUE Since, 1 * 7 = 7, which is divisible by 2+5=7 Input: N = 1234 Output: TRUE Since, 2 * 4 = 8, which is divisible by 1 + 3 = 4
- Find product of digits at even places from right to left.
- Find sum of digits at odd places from right to left.
- Then check the divisibility of product by taking it’s modulo with sum
- If modulo gives 0, output TRUE, otherwise output FALSE
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 of a number is divisible by K
- Check whether sum of digits at odd places of a number is divisible by K
- Check if product of digits of a number at even and odd places is equal
- Find the sum of digits of a number at even and odd places
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Total number of ways to place X and Y at n places such that no two X are together
- Primality test for the sum of digits at odd places of a number
- Count of numbers in range which are divisible by M and have digit D at odd places
- Check if a number has an odd count of odd divisors and even count of even divisors
- Check whether product of 'n' numbers is even or odd
- Number formed by deleting digits such that sum of the digits becomes even and the number odd
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Check whether a given number is even or odd
- Check whether given floating point number is even or odd
- Check whether count of odd and even factors of a number are equal
- C program to check whether a given number is even or odd
- Arrangement of the characters of a word such that all vowels are at odd places
- Check whether bitwise OR of N numbers is Even or Odd
- Check whether XOR of all numbers in a given range 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.