Prime Numbers

2.3

3 votes
Problem

Write a program to count the number of prime nnumbers formed by removing digits from that number from the back.(including the number itself)

eg1- if n=131 , 131 is prime no, 13(by removing 1 from last) is also prime, but 1 is not prime, so ans=2

eg 2 -49999, ans=3 as 49999 is prime, 4999 is prime and 499 is also prime. but 49 and 4 are not prime so ans=3

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?