Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <string.h>
- int main()
- {
- char a[100];
- int count=0;
- int i,j;
- printf("Enter any sentence:");
- gets(a);
- printf("Frequencies of letters in the input string:\n");
- for(i=0; i<strlen(a); i++)
- {
- if(a[i]>='A' && a[i] <='Z'|| a[i]>='a' && a[i]<= 'z')
- {
- count=1;
- for(j=i+1; j<strlen(a); j++)
- {
- if(toupper(a[i])==toupper(a[j]))
- {
- a[j]=' ';
- count++;
- }
- }
- printf("%c %c: %d\n ", toupper(a[i]),tolower(a[i]), count);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement