# Program for Cyclic Redundency Check

INPUT:
enter frame :
1 1 1 1 1 1 1 1
enter generator :
1 1 0 1

OUTPUT:

```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 #include<stdio.h> #include<conio.h> int gen[4],genl,frl,rem[4]; void main() { int  i,j,fr[8],dupfr[11],recfr[11],tlen,flag; clrscr(); frl=8;  genl=4; printf("enter frame:"); for(i=0;i<frl;i++) { scanf("%d",&fr[i]); dupfr[i]=fr[i]; } printf("enter generator:"); for(i=0;i<genl;i++) scanf("%d",&gen[i]);   tlen=frl+genl-1; for(i=frl;i<tlen;i++) { dupfr[i]=0; } remainder(dupfr);   for(i=0;i<frl;i++) { recfr[i]=fr[i]; } for(i=frl,j=1;j<genl;i++,j++) { recfr[i]=rem[j]; } remainder(recfr); flag=0; for(i=0;i<4;i++) { if(rem[i]!=0) flag++; } if(flag==0) { printf("frame received correctly"); } else { printf("the received frame is wrong"); }   getch(); }   remainder(int fr[]) { int k,k1,i,j; for(k=0;k<frl;k++) { if(fr[k]==1) { k1=k; for(i=0,j=k;i<genl;i++,j++) { rem[i]=fr[j]^gen[i]; }   for(i=0;i<genl;i++) { fr[k1]=rem[i]; k1++; } } } }```

### Projects

##### Free email signup

Get latest projects, articles in your mail box, subscribe to electrifriends

Email: