Advertisement
SabirSazzad

Frequency of all charecter in a Paragraph

Feb 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5.     char paragraph[] = "AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB) envisions promoting professionals and excellent leadership catering to the technological progress and development needs of the country.";
  6.  
  7.     int i, frequency[256] = {0};
  8.  
  9.     for(i=0; paragraph[i] != '\0'; i++)
  10.     {
  11.         frequency[paragraph[i]]++;
  12.     }
  13.  
  14.     printf("Character   \tFrequency\n");
  15.     for(i=0; i < 256; i++)
  16.     {
  17.         if(frequency[i] != 0)
  18.         {
  19.             printf(" %c \t\t%d\n",i,frequency[i]);
  20.         }
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement