Getting one test case wrong

also when i am using sqrt(n) instead if n in numprime() i am getting more test case wrong

Hello @Jun18APP0112

You interpreted the question incorrectly.
A CB number is not a prime number.
31*31 = 961 is a CB number but not a prime number.

  1. 0 and 1 are not a CB number.
  2. 2,3,5,7,11,13,17,19,23,29 are CB numbers.
  3. Any number not divisible by the numbers in point 2( Given above) are also CB numbers.

Read the problem statement again clearly.
Also use long long int instead of int as the length of the string can be upto 17 while int can only store numbers upto 2,147,483,647