what is wrongin my LRC program in C ? it gives wrong output
what is wrongin my LRC program in C ? it gives wrong output .it is just
code to made the correct parity bitcode.
#include<stdio.h>
#include<conio.h>
void main()
{ clrscr();
int a[8][8],n;
int b[8]={0,0,0,0,0,0,0,0},i,j;
//taking bitcode values
printf("enter the no. of MSG");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the code of MSG %d\n",i);
for(j=0;j<8;j++)
{
scanf("%d",a[i][j]);
}
}
//checking bitcode with bit value 1
for(i=0;i<n;i++)
{
for(j=0;j<8;j++)
{
if(a[i][j]==1)
{
b[j]++;
}
}
}
//making parity bit message in 1,0 format
for(i=0;i<8;i++)
{
if(b[i]%2==0)
{
b[i]=0;
}
else
{
b[i]=1;
}
printf("%d",b[i]);
}
getch();
}
No comments:
Post a Comment