Here is the Q:
Find the maximum number of continuous zeros,in a given Binary Number.
Binary Number : 100010000000110
Output : 7
Binary Number : 1010001
Output : 3
Here is the code i developed so far:
(I use traditional C Code supported by Turbo C++ v3.0)
where 'i' is used to keep track of the string s1,'count' is used to keep track of number of continuous zeros and 'max' stores the maximum value of zeros.
/*Binary Numbers-Max Number of Zeros*/
printf("Enter the Binary Number\n");
printf("Maximum Number of Zeros=%d",max);
When I Execute this am getting correct answer only if entered binary number contains only 1s and becomes an infinite loop if the binary number contains any zeros.
Hoping for a Fast Reply