hi can anyone help me? i cant even run the program I have made...
This program should show the distinct numbers after you inputted numbers...
I really don't know what to do, hehehe..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Distinct
{
class Program
{
static void Main(string[] args)
{
int ten = 10;
int[] first = new int[10];
int[] final = new int[10];
int counter2,counter3;
Console.Write("\nEnter 10 Numbers: ");
for (int counter = 0; counter < ten; counter++)
{
first[counter] = Convert.ToInt32(Console.ReadLine());
}
for (counter2 = 0; counter2 < ten; counter2++)
{
if (final[0] & final[1] & final[2] & final[3] & final[4] & final[5] & final[6] & final[7] & final[8] & final[9] != first[counter2])
{
final[counter2] = first[counter2];
}
}
for(counter3=0; counter3<ten; counter3++)
{
Console.WriteLine(final[counter3]);
}
Console.ReadKey();
}
}
}
there's an error here, saying "Operator '&' cannot be applied to operands of type int and bool.
for (counter2 = 0; counter2 < ten; counter2++)
{
if (final[0] & final[1] & final[2] & final[3] & final[4] & final[5] & final[6] & final[7] & final[8] & final[9] != first[counter2])
{
final[counter2] = first[counter2];
}
}
sorry.. I am extremely noob. :(