0

I'm having trouble getting accurate results on my code to get the mode. it is based on the users input. can anyone help please? this is the code I'm working on for days

    string[] ArrModeInput = new string[20];
    //USER INPUT
    Console.WriteLine("Please Enter 20 Numbers ");
    //TO INPUT
    for (int stats = 0; stats < ArrModeInput.Length; stats++)
    {
        ArrModeInput[stats] = Console.ReadLine();
    }

    //CONDITION 
    for (int stats = 0; stats < ArrModeInput.Length; stats++)
    {
        //ArrModeInput[stats] = Console.ReadLine();
        int Count = 0;
        for (int m = 0; m < ArrModeInput.Length; m++)
            if (ArrModeInput[stats] == ArrModeInput[m])
                Count = Count + 1;
        Console.WriteLine("\t\n Mode is " + ArrModeInput[stats] + ". It ocuurs " + Count + " times");
    }
TheGeneral
  • 69,477
  • 8
  • 65
  • 107
chubsy
  • 1
  • What exactly is your question here? Please clearly state the issue - what you are expecting to happen, and what is happening instead. – atiyar Jan 27 '21 at 05:01
  • the formula to find the mode pls – chubsy Jan 27 '21 at 05:07
  • Google "formula to find the mode in c#" and you'll find this community already has a lot post on that topic, with accepted answers. – atiyar Jan 27 '21 at 05:14

0 Answers0