Untitled
unknown
plain_text
8 months ago
602 B
5
Indexable
#include<stdio.h> #include<conio.h> #include<string.h> int main() { int a[20],b[30],i,j,k,count,n; printf("Enter frame lenght"); scanf("%d",&n); printf("Enter input frame(0's & 1's):"); for(i=0;i<n;i++) scanf("%d",&a[i]); i=0; count=1;j=0; while(i<n) { if(a[i]==i) { b[j]=a[i]; for(k=i+1;a[k]==1 && k<n && count<5;k++) { b[j]=a[k]; count++; if(count==5) { j++; b[j]=0; } i=k; } } else { b[j]=a[i]; } i++; j++; } printf("After stuffing the frame is:"); for(i=1;i<j;i++) printf("%d",b[i]); getch(); }
Editor is loading...
Leave a Comment