using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] array = { 10,15,6,6,5, 10, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 11, 12, 12 };
int count = 1;
for (int i = 0; i < array.Length; i++)
{
for (int j = i; j < array.Length - 1; j++)
{
if (array[j] == array[j + 1])
count = count + 1;
} Console.WriteLine("\t\n " + " Number of Duplecate value:" + " " + count);
Console.ReadLine();
}
}
}
}
Output:
No comments:
Post a Comment