Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Frequency of characters//
- #include<stdio.h>
- int main()
- {
- char str[50],ch;
- int i, frequency=0;
- printf("Enter String : ");
- gets(str);
- printf("Search a Character : ");
- scanf("%c",&ch);
- for(i=0;str[i]!='\0';i++)
- {
- if(ch==str[i])
- frequency++ ;
- }
- printf("Yes!%c found %d times(s)",ch,frequency);
- return 0;
- }
Add Comment
Please, Sign In to add comment