Advertisement
aiNayan

6(i)

Nov 30th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. char ch[50], find;
  5. int count = 0;
  6. printf("Enter a string: ");
  7. gets(ch);
  8. printf("Enter a character for finding frequency: ");
  9. scanf("%c", &find);
  10. for (int i = 0; ch[i] != '\0'; ++i) {
  11. if (find == ch[i])
  12. count++;
  13. }
  14. printf("Frequency of %c = %d", find, count);
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement