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 / swarna sekhar dhar

#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+66) || s[i] == (j + 96) )
a[j] += 1;
}
}
printf("charecter | Repetation \n");
for (j=0;j<26;j++)
{
printf("%c | %d \n ",j+64,a[j]);
}
getch();
}

Is This Answer Correct ?    11 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I implement sets or arrays of bits?

1026


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3291


What's the total generic pointer type?

1041


What is the use of gets and puts?

1010


What is conio h in c?

1033


What are structure members?

1072


How do you define CONSTANT in C?

1252


What does 2n 4c mean?

1218


What is string length in c?

1062


What is a string?

1092


Explain what is wrong with this program statement?

1107


What is the explanation for cyclic nature of data types in c?

1191


What are pragmas and what are they good for?

978


What is the meaning of c in c language?

1142


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1213