STUFF.C

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i=0,count=0,j=0;
char stuff[100],dstuff[100];
clrscr();
printf("Enter Bits You Want To Stuff :-");
scanf("%s",&stuff);
printf("\nBefore Stuff String Is :-%s",stuff);
while(i<=strlen(stuff))
{
dstuff[j++]=stuff[i];
if(stuff[i]=='1')
{
count++;
}
else
{
count=0;
}
if(count>=5)
{
dstuff[j++]='0';
count=0;
}
i++;
}
printf("\nDeStuffed Bits Are :-%s",dstuff);
getch();
}

Post a Comment

 
Top