#include <stdio.h>
#include <string.h>
int main()
{
char string[100];
int c= 0, count[26] = {0};
printf("Enter a string:\t", string);
gets(string);
while ( string[c] != '\0' )
{
if ( string[c] >= 'a' && string[c] <= 'z' )
count[string[c]-'a']++;
else if(string[c] >= 'A' && string[c] <= 'Z' )
count[string[c]-'A']++;
else
printf("");
c++;
}
for ( c = 0 ; c < 26 ; c++ )
{
if( count[c] != 0 )
printf("%c : %d\n",c+'a',count[c]);
}
return 0;
}
This is the output I recive:

I need some help counting the Uppercase Letters.

New Topic/Question
Reply


MultiQuote




|