{-='Display the number of letters in each word typed using Dev-C LaNguaGe'=-}
Display the number of letters in each word typed
#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
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.