This is the code I wrote in my college days and dont quote me on this if something does not go as expected.
Code: C
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
void main()
{
int c,i,letter[26];
for(i=0;i<26;i++)
letter[i]=0;
while((c=getchar())!='~')
{
if(isupper(c))
++letter[c-'A'];
if(islower(c))
++letter[c-'a'];
}
for(i=0;i<26;i++)
{
if(i%6==0)
printf("\n");
printf("%5c %4d",'A'+i,letter[i]);
}
printf("\n\n");
getch();
}

