i want to have a program to read a string and print the
frequency of each character and it should work in turbo c
Answer Posted / rahul
#include<stdio.h>
#include <conio.h>
void main()
{
int a[26],i,l,j;
char s[180];
clrscr();
for(i=0;i<26;i++)
a[i]=0;
printf("enter a string: \n");
gets(s);
l=strlen(s);
for(i=0;i<l;i++)
{
for(j=0;j<26;j++)
{
if (s[i] == (j+65) || s[i] == (j + 97) )
a[j] += 1;
}
}
printf("charecter | Repetation \n");
for (j=0;j<26;j++)
{
printf("%c | %d \n ",j+65,a[j]);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
how logic is used
What is the use of pointers in C?
What is strcmp in c?
What is the difference between functions getch() and getche()?
What are the __date__ and __time__ preprocessor commands?
What is maximum size of array in c?
What is #define?
what value is returned to operating system after program execution?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
write a program to display all prime numbers
please send me the code for multiplying sparse matrix using c
What is anagram in c?
Which programming language is best for getting job 2020?
Explain what are the standard predefined macros?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?