#include <stdio.h>
      int main() {
          char str[1000], ch;
          int count = 0;
          printf("Enter a string: ");
          fgets(str, sizeof(str), stdin);
          printf("Enter a character to find its frequency: ");
          scanf("%c", &ch);
          for (int i = 0; str[i] != '\0'; ++i) {
              if (ch == str[i])
                  ++count;
          }
          printf("Frequency of %c = %d", ch, count);
          return 0;
      }
      
      C language logo

      Frequent

      0

      0

      avatar
      natalie19970

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.