using System;
public class Program
{
public static void Main()
int[] intArr = new int[] {0,0,0,0};
Console.WriteLine(MaxConsecutiveOnes(intArr));
}
public static int MaxConsecutiveOnes(int[] arr)
int count = 0; //initialize count
int result = 0; //initialize max
for (int i = 0; i < arr.Length; i++)
// Reset count when 0 is found
if (arr[i] == 0)
count = 0;
// If 1 is found, increment count
// and update result if count
// becomes more.
else
count++; //increase count
result = Math.Max(result, count);
return result;