Calculate the frequency of characters in the given string

Input is accepted by variable str and the array cnt stores the frequency of each character.Initially 0 is stored in array cnt. Each and every character of the character array is considered and '\0' represents the end of the string.Two different character ranges are considered i.e. A to Z and a to z.Suppose the input string is Ad.The ASCII value of 'A' is 65 and 'b' is 98.For the character 'A', the value will be calculated as,

- cnt[ str[i] - 'A' ]++

- The value of str[i] is 'A'.The ASCII value of 'A' is 65.So 65-65=0.The value of 0th position is incremeneted by 1 i.e. 1 is stored in 0th position.

For the character 'd',the value will be calculated as,

-cnt[ str[i] - 'a' ]++

-The value of str[i] is 'd' and the ASCII value of 'd' is 100.So 100-97=3.The value of 3rd position is incremented by 1 i.e. 1 is stored in 3rd position.

When the array cnt is printed,it gives the frequency of each character.

#include < stdio.h >
#include < conio.h > 
void main()
{
	char str[100];
	int i,cnt[26];
	clrscr();
	for(i=0;i < =26;i++)
	cnt[i]=0;
	printf("Enter the string\n");
	flushall();
	gets(str);	
	for(i=0;str[i]!='\0';i++)
	{
		if(str[i] > ='A'&& str[i] < ='Z')
		{
			cnt[ str[i] - 'A' ]++;
		}
		else
		if(str[i] > ='a'&& str[i] < ='z')
		{
			cnt[ str[i] - 'a' ]++;
		}
	}
	for(i=0;i < =26;i++)
	{
		if(cnt[i]>0)
		{
			printf("%c occurs %d times\n ",'A'+i,cnt[i]);
		}
	}
}//main