#include <stdio.h> int main() { char string[100]; int c = 0, count[26] = {0}; printf("Enter a string"); gets(string); while ( string[c] != '\0' ) { if ( string[c] >= 'a' && string[c] <= 'z' ) count[string[c]-'a']++; c++; } for ( c = 0 ; c < 26 ; c++ ) { if( count[c] != 0 ) printf("%c occurs %d times in the entered string.\n",c+'a',count[c]); } return 0; }
Friday, May 13, 2016
Subscribe to:
Post Comments (Atom)
!->
0 Comment to "Calculate Alphabets Of String."
Post a Comment