1#include <stdio.h>
2int main() {
3 char str[1000], ch;
4 int count = 0;
5
6 printf("Enter a string: ");
7 fgets(str, sizeof(str), stdin);
8
9 printf("Enter a character to find its frequency: ");
10 scanf("%c", &ch);
11
12 for (int i = 0; str[i] != '\0'; ++i) {
13 if (ch == str[i])
14 ++count;
15 }
16
17 printf("Frequency of %c = %d", ch, count);
18 return 0;
19}
20