C program – Finding remainder

by Nideesh C on April 17, 2011 · 0 comments

in C Programming




#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



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to convert the given binary number into decimal
  2. C program to accept a decimal number and conert it binary and count the number of 1′s in the binary number
  3. C program to convert the given binary number into its equivalent decimal
  4. C program to convert the given binary number into its equivalent decimal
  5. C program – Calculate the greatest Common Divisor (GCD) of a number

Leave a Comment

Previous post:

Next post: