displaying characters and how many times they appear?
<p>I get a string from the user and then put it in a char array. Now I want to display all the characters in the string along with how many times they appear. My code is as follows Please Correct me ?</p>

<pre><code> using System;
 class count
 {
    public void charcount()
    {
       int i ;
       int count = 0;
       string s;
       Console.WriteLine("Enter the String:");
       s = Console.ReadLine();
       char[] carr = s.ToCharArray();
       for(i = 0; i &lt; carr.Length; i++)
       {
         for(int j = 1; j &lt; carr.Length; j++)
             {
               if(carr[j] == carr[i])
                       {
                count++;
                   }
                   else
                       {
                    return;
               }
               Console.WriteLine("The Character " + carr[i] + " appears " + count);
         }
       }        
    }

    static void Main()
    {
       count obj = new count();
       obj.charcount(); 
    }
  }
</code></pre>
