0% found this document useful (0 votes)
99 views5 pages

1) Write A Program To Implement VRC and LRC. Code (VRC Program)

Uploaded by

s81924465
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views5 pages

1) Write A Program To Implement VRC and LRC. Code (VRC Program)

Uploaded by

s81924465
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1] Write a program to implement VRC and LRC.

Code (VRC Program):

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

char *a,*b,*c,*d;

int i,l,c1,c2,c3,e;

clrscr();

top:

printf("\nEnter 1st Dataword: ");

gets(a);

if(strlen(a)!=7)

printf("Invalid Data");

goto top;

else

for(i=0;i<strlen(a);i++)

if(a[i]=='1' || a[i]=='0')

continue;

else
{

printf("enter binary digits");

goto top;

top1:

printf("\nEnter 2nd Dataword: ");

gets(b);

if(strlen(b)!=7)

printf("Invalid Data");

goto top1;

else

for(i=0;i<strlen(b);i++)

if(b[i]=='1' || b[i]=='0')

continue;

else

printf("enter binary digits");

goto top1;

}
}

top2:

printf("\n3rd Enter Dataword: ");

gets(c);

if(strlen(c)!=7)

printf("Invalid Data");

goto top2;

else

for(i=0;i<strlen(c);i++)

if(c[i]=='1' || c[i]=='0')

continue;

else

printf("enter binary digits");

goto top2;

l=strlen(a);

for(i=0;i<l;i++)
{

c1=c2=c3=0;

if(a[i]=='1')

c1++;

if(b[i]=='1')

c2++;

if(c[i]=='1')

c3++;

e=c1+c2+c3;

if(e%2==0)

d[i]='1';

else

d[i]='0';

for(i=0;i<l;i++)

printf("%c",d[i]);

d[i]='\0';

strcat(a,b);

strcat(a,c);

strcat(a,d);

printf("\nLRC: ");

puts(a);

getch();
}

You might also like