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...

C program to find frequency of each character in a text
file?

Answer Posted / silky

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;

int main()
{
char a[100],s[100];
gets(a);
int i,c[27],j;

for(int i=0;i <=26;i++)
c[i]=0;

for(i=0;i<strlen(a);i++)
{
if(a[i]>='a' && a[i]<='z')
{
c[ a[i] - 'a' ]++;
}
}

for(j=0;j <=26;j++)
{
if(c[j]>0)
{
printf("%c occurs %d times\n ",'a'+j,c[j]);
}
}

}

Is This Answer Correct ?    5 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 4 data types?

1023


Why malloc is faster than calloc?

1068


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1768


What are the different types of linkage exist in c?

1035


How many types of errors are there in c language? Explain

991


What are the differences between new and malloc in C?

1150


the question is that what you have been doing all these periods (one year gap)

2092


Explain what is #line used for?

1073


How many header files are in c?

1040


Explain what is dynamic data structure?

1171


What is methods in c?

1100


What is string constants?

1152


What are the different types of endless loops?

1082


how many key words availabel in c a) 28 b) 31 c) 32

1082


Explain what does the format %10.2 mean when included in a printf statement?

1367