PROBLEM LINK:
Practice
Author: Rupanjan Hari
Tester: Rupanjan Hari
DIFFICULTY
: Easy
PREREQUISITES
: Math
QUICK EXPLANATION
Given an integer N, traverse its digits (d1,d2,…,dn) and determine how many digits evenly divide N(i.e.: count the number of times N divided by each digit di has a remainder of 0). Print the number of evenly divisible digits.
Note: Each digit is considered to be unique, so each occurrence of the same evenly divisible digit should be counted (i.e.: for N=111, the answer is 3).
EXPLANATION
To make the problem look easy, I have divided the program into functions of appropriate name.
Arrays:
a[] - The primary array that receives all the numbersFunctions:
int count(long long int n) - This function counts the digits that evenly divide the number.
In the main function just call the count function for each number.
SOLUTION:
click here to see the solution