I am writing a C program to ask the user to enter in a pin code and checks if each digit in the number is divisible by 2. For instance, if they enter 123452 it tells the user that it is wrong because 1,2,3,5 isn't divisible by 2. If I enter 642642 it says it is fine but if I enter in 622248 it displays invalid number, which is wrong because every digit in 622248 is divisible by 2. How can I fix this error?

```
#include <stdio.h>
#define N 6 

int main(void)
{
    int num, digits[N], i, invalid, count = 1, sum = 0;

    TOP:
    printf("Enter pin code (attempt %d): ", count++);
    scanf("%d", &num);

    invalid = num;
    // stores each digit of the number entered into the the array
    for (i = 6; i >= 0; i--) {
        digits[i] = num % 10;
        num = num / 10; 
    }
    // if the user enters more than 6 digits than it will give you an error.
    if (digits[N] > 6) {
       printf("Code %d is invalid!\n", invalid); 
       goto TOP;
    } 
    // loops through the array elements and see if each digit is divisble by 2, if not then print an error.
    for (i = 0; i < 6; i++) {
        if (digits[i] % 2 != 0) {
            printf("Code %d is invalid!\n", invalid); 
            goto TOP;
        }
        else {
            printf("Congratulation, code %d is valid!\n", invalid);
            break;
        }
    }

    return 0;
}

```