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

Are the outer parentheses in return statements really optional?

1050


How would you use the functions fseek(), freed(), fwrite() and ftell()?

1104


What is time complexity c?

941


Explain the difference between the local variable and global variable in c?

1025


Explain what is the benefit of using const for declaring constants?

967


Explain how can I open a file so that other programs can update it at the same time?

1056


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

1171


What is the usage of the pointer in c?

1043


Dont ansi function prototypes render lint obsolete?

1062


Is r written in c?

1110


Give differences between - new and malloc() , delete and free() ?

1045


What is c language and why we use it?

1004


What is %lu in c?

1180


What functions are used in dynamic memory allocation in c?

1017


What is the use of header files?

1058