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

what is use of malloc and calloc?

1891


Tell me can the size of an array be declared at runtime?

1018


What is the difference between test design and test case design?

2077


Explain how do you view the path?

1146


How #define works?

1085


What is pointer and structure in c?

1148


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1075


Differentiate fundamental data types and derived data types in C.

1021


What are lookup tables in c?

986


application attempts to perform an operation?

1959


Sir i need notes for structure,functions,pointers in c language can you help me please

2396


What are the features of c languages?

1080


What does void main () mean?

1219


What is structure packing in c?

1064


What is pass by value in c?

1055