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

How to get string length of given string in c?

1024


What is %d called in c?

1189


Why clrscr is used in c?

964


What is spark map function?

1071


What do you mean by invalid pointer arithmetic?

1016


Where are some collections of useful code fragments and examples?

1119


how to make a scientific calculater ?

2028


how should functions be apportioned among source files?

1074


How can you read a directory in a C program?

1102


Can we access array using pointer in c language?

1054


What is a substring in c?

1007


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1028


What does %p mean?

1040


What is pointer to pointer in c language?

1072


Explain the difference between malloc() and calloc() function?

1001