write a program to print the number of the prime digits of an entered number
Answers
Answered by
0
Answer:
sorry don't know the answer
Answered by
0
Answer:
Input: N = 12
Output: 1
Explanation:
Digits of the number - {1, 2} But, only 2 is prime number.
Input: N = 1032
Output: 2
Explanation:
Digits of the number - {1,0,3, 2}
3 and 2 are prime number
Explanation:
Approach: The idea is to iterate through all the digits of the number and check whether the digit is a prime or not. Since there are only four possible prime numbers in the range (0,9) and every digit for sure lies in this range, we only need to check the number of digits equal to either of the elements in the set {2, 3, 5,7).
Similar questions