Preview:
using System;
class MaxOccurringChar
{
    static void Main()
    {
        Console.Write("Enter a string: ");
        string str = Console.ReadLine();
        int[] freq = new int[256];

        foreach (char c in str)
            freq[c]++;

        int max = 0;
        char result = ' ';

        foreach (char c in str)
        {
            if (freq[c] > max)
            {
                max = freq[c];
                result = c;
            }
        }

        Console.WriteLine($"Maximum occurring character: {result}");
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter