C program for function of count the characters in each word, C/C++ Programming

C Program for FUNCTION OF COUNT THE CHARACTERS IN EACH WORD

void count(char c[]);

void main()

{

          char a[50];

          int i=0;

          clrscr();

          printf("ENTER THE STRING: ");

          do

          {

                   a[i++]=getchar();

          }while(a[i-1]!='\n');

 

          a[i]='\0';

          count(a);

          getch();

}

void count(char a[])

{

          int i=0,l[25],c=0;

          for(i=0;i<25;i++)

                   l[i]=0;

          for(i=0;a[i]!='\0';i++)

          {

                   if(a[i]!=' ' && a[i]!='\n')

                             l[c]=l[c]+1;

                   else

                             c++;

          }

          for(i=0;l[i]!=0;i++)

                   printf("WORD : %d : %d\n",i+1,l[i]);

}

 

OUTPUT :

ENTER THE STRING: KAMLESH D MENGAR

 

WORD 1 : 7

WORD 2 : 1

WORD 3 : 6

Posted Date: 9/10/2012 7:50:36 AM | Location : United States







Related Discussions:- C program for function of count the characters in each word, Assignment Help, Ask Question on C program for function of count the characters in each word, Get Answer, Expert's Help, C program for function of count the characters in each word Discussions

Write discussion on C program for function of count the characters in each word
Your posts are moderated
Related Questions
Hi is there any chance to get assignment for fresher tutor

how yo use the friend function?


Question 1 Consider you have to find out average marks of 100 students in a class. Write simple program(s) using different iteration statements to accomplish it Question 2 Expla


Binary Options EA for DirectFX and SignalPush Project Description: I want a programmer who will build an EA based on my three types of Binary strategy's using two Indicators.

Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

Dynamic Initialization of objects: It is initializing the objects by passing the valued to the constructor from the user input or other means.   Through cin operator a value

write c language program that shows stack overflow..

Implement multiple stacks in a single dimensional array using c.