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

List the difference between a While & Do While loops?

1068


Differentiate between new and malloc(), delete and free() ?

1152


Why does notstrcat(string, "!");Work?

1101


What is #include conio h?

974


What is difference between static and global variable in c?

1003


What are multibyte characters?

1074


What's the best way of making my program efficient?

1056


Is c high or low level?

977


What are the back slash character constants or escape sequence charactersavailable in c?

1154


Write a program to show the change in position of a cursor using c

1015


What is spaghetti programming?

1097


Can you tell me how to check whether a linked list is circular?

1362


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2711


What is union and structure?

1064


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1652