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

Answers were Sorted based on User's Feedback



i want to have a program to read a string and print the frequency of each character and it should..

Answer / 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

i want to have a program to read a string and print the frequency of each character and it should..

Answer / 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

i want to have a program to read a string and print the frequency of each character and it should..

Answer / shashi

33 45

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More C Interview Questions

write c program without semicolon

11 Answers   MindTech, TCS, Wipro,


how to multiply two number taking input as a string (considering sum and carry )

2 Answers   Wipro,


What is the meaning of c in c language?

0 Answers  


What is the difference between c &c++?

0 Answers  


How can I find the modification date of a file?

0 Answers   Celstream,


what is the different between data structure and data type?

1 Answers   Ignou,


How is null defined in c?

0 Answers  


What is the difference between typedef and #define?

0 Answers  


What is pointer to pointer in c with example?

0 Answers  


What are the different types of pointers used in c language?

0 Answers  


how to execute a program using if else condition and the output should enter number and the number is odd only...

0 Answers  


#include<stdio.h> main() { int a=1; int b=0; b=++a + ++a; printf("%d %d",a,b); }

7 Answers   Infosys,


Categories