Plzzzz help !!!!
consider max. limit of letters as 15 for input string.
^^ The output string should not display any other characters/numbers or any message except the output string
Attachments:
Answers
Answered by
6
In simple, your question is to find frequency of character.
Here is a sample program to find frequency of character:
#include<stdio.h>
#include<string.h>
int main()
{
char str[50];
int a[256] = {0},i;
printf("Enter any string: ");
scanf("%s", &str);
for(i = 0; str[i] != '\0'; i++)
{
a[str[i]]++;
}
printf("\n The frequency of characters are: \n");
for(i=0; i<256; i++)
{
if(a[i] != 0)
{
printf("\n%d %c", a[i], i);
}
}
return 0;
}
Output:
Enter any string: aaabbccdddd
The frequency of characters are:
3 a
2 b
2 c
4 d.
Hope it helps! ---------- > Good Luck!
dragonride1:
array elment with corresponding value
Similar questions
Computer Science,
7 months ago
India Languages,
7 months ago
Chemistry,
1 year ago
Physics,
1 year ago
Physics,
1 year ago