Pages

Remainder Finding Program

/* Write a program to find Remainder*/

#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

If you like this please Link Back to this article...



0 comments:

Post a Comment