0
Hi everyone I have a problem
How can find most number in c# using array and methods
10 odpowiedzi
+ 1
1. Open Code Playground
2. Type your code there
3. Save it as public
4. Edit your question including a link to your code in Code Playground
5. Edit your question explaining the difficulties you have
0
This is my attemp
0
Mirielle
int[] array = new int[6] { 3, 4, 3, 5, 5, 3 };
int count = 1, tempCount;
int frequentNumber = array[0];
int tempNumber = 0;
for (int i = 0; i < (array.Length - 1); i++)
{
tempNumber = array[i];
tempCount = 0;
for (int j = 0; j < array.Length ; j++)
{
if (tempNumber == array[j])
{
tempCount++;
}
}
if (tempCount > count)
{
frequentNumber = tempNumber;
count = tempCount;
0
i cant uderstand can you help me for sloving this question
0
Mirielle
Emerson Prado
This your requirment
0
Arazdeary When you run the code, the app shows 2 syntax errors, with a very clear explanation on how to solve. Just do as the errors say. The one about curly brackets refers to the last 'if' block.
0
Emerson Prado
Can you answer messege