Code:
int SEQstart(int n){
int x=0,y=1,place=0,coun=0,result=0,start;
printf("Please enter binary seq size:%d\n",n);
while (place < n)
{
while (x&&y==1 || x&&y==0) //// x,y can be only 1,0
{
if (x==y) coun++; //// coun=0 first itration
else coun=0; ////
scanf("%d",&x); //// getting REAL x for first time so place ++
place++;
if (coun>result) //// (0) first itration
{
result=coun;
start=place-1;
}
scanf("%d",&y); //// getting REAL y first time so place ++ and now 2
place++;
}
}
return start;
}
int main (){
int n=12;
printf("%d\n",SEQstart(n));
return 0;
}
I think i might have a problem with logic... any help ?
input: binary seq size n (110001111010,n=12)
output: staring place of biggest == seq (110001111010) -->place:6
no arrays allowed.