Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- define N 7
- main()
- {
- char str[N+1]= {0};
- printf("Enter alphabets: ");
- gets(str);
- printf("Alphabets are %s\n", str);
- char ch;
- int i=0;
- int count[26]={0};
- while( (ch=str[i]) != '\0')
- {
- count[ch-'a']++;
- i++;
- }
- for(i=0;i<26;i++)
- {
- if(count[i])
- {
- printf("%c %d\n",i+'a',count[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement