Display the number of letters in each word typed

clarence_cool03 0 Tallied Votes 148 Views Share

{-='Display the number of letters in each word typed using Dev-C LaNguaGe'=-}

#include <stdio.h>

int main (void)
{
//	Local Declarations
	char letters[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    int frequency[27]= { 0 };
    int i, f;
    
//  Statements
    printf("\nEnter your characters: \n");
    scanf(" %c", &letters[i]);
    for(i = 0; i < letters[i]; i++) 
     {
         f = letters[i];
         frequency[f]++;         
     }// for
    
   	for (i = 0; i < 27; i++)
	   printf(" %c - %d\n", letters[i], frequency[i]);
	printf("\n");
	
	system("pause");
	return 0;
}// main