Professional Documents
Culture Documents
Program:
#include<stdio.h>
void main()
{
int si=0,di=0,c=0;
char src[20],des[50]="",flag[]="01111110";
clrscr();
printf("enter the string");
scanf("%s",&src);
strcat(des,flag);
di=strlen(flag);
while(src[si]!='\0')
{
if(src[si]=='1')
c++;
else
c=0;
des[di]=src[si];
di++;
si++;
if(c==5)
{
des[di]='0';
di++;
c=0;
}
}
des[di]='\0';
strcat(des,flag);
printf("%s",des);
getch();
}
Output:
Enter the string 11111111
The stuffed string is 011111011111011101111110
Output:
Enter the data 0111111011111011101111110
Data is 11111111
Output:
Enter data aDLEb
The stuffed string is DLESTaDLEDLEbDLESTX
Output:
Enter data DLESTXADLEDLEBDLEETX
The destuffed string is ADLEB
}
remainder(int fr[])
{
int k,k1,i,j;
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++;
}
}
}
}
Output:
Enter the frame: 11111111
Enter generator: 1111
Frame received correct
Output:
Enter the frame: 10111
Enter generator: 1110001111001
The received frame is correct
Output:
Enter the frame: 11111
Enter generator: 11110000111100001
The received frame is correct
break;
}
getch();
}
Output:
Enter the cost matrix:
01420
00023
00030
00005
00000
Enter number of paths:4
Enter possible paths:
12450
12500
14500
13450
Minimum cost:4
Minimum cost path:
1- ->2- ->5