[]
//variable declaration//
int []num;
int duplicate=0,size,temp=0,n=0;
//input//
Console.Write("Input Size: ");
size=int.Parse(Console.ReadLine());
num = new int[size];
for (int i = 0; i < size; i++)
{
do
{
duplicate = 1;
Console.Write("Input a number[" + i + "]: ");
num[i] = int.Parse(Console.ReadLine());
if (temp == num[i])
{
duplicate = 0;
Console.WriteLine("It Is A Duplicate");
}
temp = num[i];
} while (duplicate == 0);
}
[]
Above is my code for trapping duplicates...
But it seems that it can only identify duplicates if and only it is being input consecutively...
What i mean is:
<Sample Input/Output>
Input A Number[0]: 1
Input A Number[1]:1
It Is A Duplicate
Input A Number[1]:2
Input A Number[2]:1
<<<<<<<<>>>>>>
As you can see when i input the value 1 on the 3rd index it didn't recognize that value as duplicated...
Looking forward to your kind answers on what is lacking on my code...
thanks....

,)