Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- int main() {
- // Here 129 means 128 characters are allocated to memory.
- char text[129];
- // The character you want to find.
- char find;
- int i = 0, count = 0;;
- printf("Enter Text: ");
- // %[^\n]%s is used to take input till you press Enter
- scanf("%[^\n]%*c", text);
- printf("Enter Character To Find: ");
- scanf("%c", &find);
- for(i = 0; i < strlen(text); i++){
- // Check Each Character
- if(tolower(text[i]) == tolower(find)){
- count++;
- }
- }
- printf("Frequency: %d", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement