Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how logic is used

1977


What is the use of pointers in C?

1084


What is strcmp in c?

1128


What is the difference between functions getch() and getche()?

1098


What are the __date__ and __time__ preprocessor commands?

1121


What is maximum size of array in c?

1047


What is #define?

1121


what value is returned to operating system after program execution?

2125


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

1184


write a program to display all prime numbers

1974


please send me the code for multiplying sparse matrix using c

2182


What is anagram in c?

927


Which programming language is best for getting job 2020?

1053


Explain what are the standard predefined macros?

1122


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

1115