Hi everyone I have a problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi everyone I have a problem

How can find most number in c# using array and methods

28th Apr 2022, 9:49 PM
Arazdeary
Arazdeary - avatar
8 Answers
+ 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
29th Apr 2022, 1:11 PM
Emerson Prado
Emerson Prado - avatar
0
This is my attemp
28th Apr 2022, 9:49 PM
Arazdeary
Arazdeary - avatar
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;
28th Apr 2022, 11:11 PM
Arazdeary
Arazdeary - avatar
0
i cant uderstand can you help me for sloving this question
28th Apr 2022, 11:17 PM
Arazdeary
Arazdeary - avatar
29th Apr 2022, 2:32 PM
Arazdeary
Arazdeary - avatar
0
Mirielle Emerson Prado This your requirment
29th Apr 2022, 2:32 PM
Arazdeary
Arazdeary - avatar
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.
30th Apr 2022, 2:28 AM
Emerson Prado
Emerson Prado - avatar
0
Emerson Prado Can you answer messege
30th Apr 2022, 2:34 AM
Arazdeary
Arazdeary - avatar