program to read and analyze passwords

So I have to set up a program that will prompt a user to enter a password between 5 and 8 digits long and then it has to analyze whether or not the password follows these rules.
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).

I think I've got the first part, but determining the palindrome is causing problems for me so far. Any help is greatly appreciated.

this is what I have so far:

#include <stdio.h>
int main(void) {

int pass = 0;
int counter = 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{}

return 0;
}
Topic archived. No new replies allowed.