So I need to write a code that prompts the user to enter a 5-8 digit number and i have the following guidelines,

1. The password must be between 5 and 8 digits long (assume no leading zeros are entered – for example: 002345 is considered only 4 digits for our purposes).

2. The last five digits of the password must be a palindrome (i.e. the same backwards as it is forwards, such as 52425).

3. The last three digits of the password must be a prime number (i.e. if the password entered was 730103, 103 is prime).

so far i have some of it down but I'm having trouble with the palindrome part, can anyone explain how to split up a number and then check for palindrome.

also, this is what i have so far

Code:#include <stdio.h> int main(void) { int pass = 0; int counter = 0; int num1 = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; printf("Enter a password between 5 and 8 digits.\n"); scanf("%d",&pass); while(pass){ pass=pass/10; counter++; } if(!((counter<=8)&&(counter>=5))){ printf("Password is invalid, must be between 5 and 8 digits.\n") }else{ if(){ //check for palindrome with ! at beginning printf("Password is invalid, last 5 digits are not a palindrome") }else{ } } return 0; }