Program to implement Cyclic Redundancy Check,CRC-12

#include<conio.h>
#include<string.h>
#include<dos.h>
#include<stdlib.h>
int copy();
int check();
int i, j, k, t, count = 0, num = 0;
int gen[10], frame[30], rem[30], temp[30];
void main()
{
    char c, plym[50];
    char ch[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
    clrscr();
    printf("\t\t\t***CYCLIC REDUNDANCY CHECK-12***\n\n\n");
    for(i = 0; i < 50; i++)
    plym[i] = '\0';
    for(i = 0; i < 30; i++)
    temp[i] = rem[i] = frame[i] = '\0';
    for(i = 0; i < 10; i++)
    gen[i] = '\0';
    printf("enter the polynomial: ");
    gets(plym);
    plym[strlen(plym)] = ' ';
    for(i = 0; i < strlen(plym); i++)
    {
    if(plym[i] == 'x')
    {
        i++;
        for(; plym[i] != ' '; count, i++)
        {
        }
        if(count == 3)
        {
        for(i = i - 1,j = 3; j <= 9; j++)
        if(plym[i] == ch[j])
        {
            printf("\Enter the polynomial's");
            printf("degree is high");
            getch(); exit(0);
        }
        for(j = 0, num = 10; j <= 2; j++)
        if(plym[i] == ch[j])
        {
            num = num + j;
            frame[num] = 1;
        }
        }
        if(count == 2)
        {
            for(i = i - 1, j = 1, num = 0; j <= 9; j++)
            if(plym[i] == ch[j])
            num = j;
            frame[num] = 1;
        }
        if(count == 0)
        frame[1] = 1;
        count = 0;
    }
    else if(plym[i] == '1')
    frame[0] = 1;
    }
    printf("FRAME is: ");
    for(i = 12, j = 0; i >= 0; i--, j++)
    {
        temp[j] = frame[i];
        printf("%d", frame[i]);
    }
    printf("\n\n\n>>>>both high & low orders");
    printf("bits of GENERATOR must be 1<<<<");
    printf("\n enter the generator: ");
    for(num = i = 0; (c = getchar()) != '\n'; i++, num)
    {
        if(c == '1')
        gen[i] = 1;
        else if(c == '0')
        gen[i] = 0;
        else
        {
            printf("\n Enter the GENERATOR");
            printf("is other then 0 or 1");
            getch(); exit(0);
        }
    }
    for(j = 13, i = i - 1; i >0 ; i--, j++)
    temp[j] = 0;
    printf("\n\n FRAME after appending 0's: ");
    copy(); check();
    printf("\n The REMAINDER is: ");
    for(i = 13; i < j; i++)
    {
        temp[i] = rem[i];
        printf("%d", rem[i]);
    }
    printf("\n\n\n Transmitting FRAME......");
    delay(10000);
    printf("\n\n\n Transmitted FRAME is: ");
    copy(); check();
    printf("\n frame recieved");
    printf("\n\n\n checking for errors......");
    delay(10000);
    printf("\n\n\n recieved frame is: ");
    copy(); check();
    printf("\n the remainder is: ");
    for(i = 13; i < j; i++)
    printf("%d", rem[i]);
    printf("\n DATA SENT SUCCESSFULLY");
    getch();
}
check()
{
    for(i = 0; i <= 12; i++)
    {
        if(rem[i] == 0)
        continue;
        else
        {
            for(k = 0, t = i; k < num; k++, t++)
            {
                if(rem[t] == 1 && gen[k] == 1)
                rem[t] = 0;
                else if(rem[t] == 0 && gen[k] == 0)
                rem[t] = 0;
                else if(rem[t] == 1 && gen[k] == 0)
                rem[t] = 1;
                else if(rem[t] == 0 && gen[k] == 1)
                rem[t] = 1;
            }
        }
    }
    return 0;
}
copy()
{
    for(i = 0; i < j; i++)
    {
        printf("%d", temp[i]);
        rem[i] = temp[i];
    }
    return 0;
}

Output:

***CYCLIC REDUNDANCY CHECK-12***

enter the polynomial: x^8 x^7 x^3 x^2 1
FRAME is: 0000110001101

>>>>both high & low ordersbits of GENERATOR must be 1<<<<
enter the generator: 10011

FRAME after appending 0's: 00001100011010000
The REMAINDER is: 0101

Transmitting FRAME......

Transmitted FRAME is: 00001100011010101
frame recieved

checking for errors......
recieved frame is: 00001100011010101
the remainder is: 0000
DATA SENT SUCCESSFULLY