Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Write a program to print a histogram of the frequencies of different characters in its input*/
- //Horizontal Version
- #include<stdio.h>
- //characters in ASCII code from number 32 to 127
- main()
- {
- char characters [95];
- int c,i,l,counter;
- for(i=0;i<=95;i++)
- {
- characters[i]=0;
- }
- printf("Insert your input:\n");
- while((c=getchar())!=EOF)
- {
- characters[c-37]++;
- }
- for (i=0;i<=95;i++)
- {
- printf("|%c|",i+37);
- for(counter=1;counter<=characters[i];++counter)
- {
- printf("*");
- }
- printf("\n");
- }
- scanf("%d,l");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement