Advertisement
murad45

Programming task - 03

Apr 26th, 2021
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     char s[1000];
  7.     int  i,j,k,count=0,n;
  8.  
  9.     printf("Enter  the string : ");
  10.     gets(s);
  11.  
  12.     for(j=0;s[j];j++);
  13.      n=j;
  14.  
  15.     printf(" frequency count character in string:\n");
  16.  
  17.     for(i=0;i<n;i++)
  18.     {
  19.         count=1;
  20.         if(s[i])
  21.         {
  22.  
  23.           for(j=i+1;j<n;j++)
  24.           {
  25.  
  26.             if(s[i]==s[j])
  27.             {
  28.                  count++;
  29.                  s[j]='\0';
  30.             }
  31.           }
  32.           printf(" '%c' = %d \n",s[i],count);
  33.  
  34.  
  35.  
  36.        }
  37.  
  38.  
  39.     }
  40.  
  41.  
  42.     return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement