#include int checkIfPrime(int x); int main() { //int low=0,high=0; int number = 0; printf("Enter the number:"); scanf("%d",&number); int n = number,div = 1; int leftTruncatable = 1,rightTruncatable = 1,both = 1; while(n>0) { if(checkIfPrime(n) == 0 ) { rightTruncatable = 0;both = 0; } n = n/10; div = div *10; } div = div /10; n = number; while(n>0) { if(checkIfPrime(n) == 0 ) { leftTruncatable = 0;both = 0; } n = n%div; div = div /10; } if(both == 1) { printf("The Number : %d is both left and right truncatable\n",number); } else if(leftTruncatable == 1 ) { printf("The Number : %d is only left truncatable\n",number); } else if(rightTruncatable == 1 ) { printf("The Number : %d is only right truncatable\n",number); } else { printf("The Number : %d not truncatable\n",number); } return 0; } int checkIfPrime(int x) { int i=0; int isPrime = 1; for(i=2;i<= x/2;i++) { if(x%i==0) { isPrime = 0; return isPrime; } } return isPrime; }