C program for finding remainder

OUTPUT:
enter frame:
1 0 1 1 0 1 0 0
enter generator:
1 0 1 0
remainder is:
0 0 1 0

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
#include<stdio.h>
#include<conio.h>
void main()
{
 int  i,j,gen[4],rem[4],frl=8,genl=4,k,k1,fr[11];
 clrscr();
 printf("enter frame:");
 for(i=0;i<frl;i++)
{ 
scanf("%d",&fr[i]);
} 
for(i=frl;i<11;i++)
{ 
fr[i]=0;
}
printf("enter generator:");
 for(i=0;i<4;i++)
 scanf("%d",&gen[i]);
  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++;
    }
   }
    }
      printf("\nremainder is: ");
      for(i=0;i<4;i++)
     printf("%d",rem[i]);
     getch();
}

OUTPUT:
enter frame:
1 0 1 1 0 1 0 0
enter generator:
1 0 1 0
remainder is:
0 0 1 0

Editorial Team
Editorial Team

We are a group of young techies trying to provide the best study material for all Electronic and Computer science students. We are publishing Microcontroller projects, Basic Electronics, Digital Electronics, Computer projects and also c/c++, java programs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in