C program to find the even words in the string, C/C++ Programming

C Program to FIND THE EVEN WORDS IN THE STRING

#include conio.h>

#include stdio.h>

void main()

{

          char a[50],temp;

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

 

          clrscr();

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

          {

                   l[i]=0;

          }

          i=0;

          printf("ENTER THE STRING: ");

          do

          {

                   a[i++]=getchar();

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

          a[i]='\0';

          printf("%s",a);

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

          {

                   if(a[i]==' ' || a[i]=='\n')

                   {

                             temp=a[k];

                             a[k]=a[i-1];

                             a[i-1]=temp;

 

k=i+1;

                             c++;

                   }

                   else

                   {

                             l[c]++;

                   }

          }

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

          {

                   if(l[i]%2==0)

                   {

                    r++;

                   }

          }

          printf("%s\n",a);

          printf("THE TOTAL NO OF EVEN WORDS ARE:  %d",r);

          getch();

}

OUTPUT :

ENTER THE STRING: KAMLESH D MENGAR

HSELMAK D RAGNEM

THE EVEN WORDS ARE : 1

 

 

Posted Date: 9/10/2012 7:21:01 AM | Location : United States







Related Discussions:- C program to find the even words in the string, Assignment Help, Ask Question on C program to find the even words in the string, Get Answer, Expert's Help, C program to find the even words in the string Discussions

Write discussion on C program to find the even words in the string
Your posts are moderated
Related Questions
In this sub-task will you implement three functions for the final three function prototypes that will do exactly the same as the three functions that you have just written. This ti

how to find minimum number if shelves required


Write a method (belonging to the TermStructure class) that takes a pointer to an array of bonds and an integer, representing the number of bonds in the array as arguments, and esti

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Poker Room auto seat program Project Description: I want a script for an online poker site. It requires to be scanning all the available tables and when the table meets certa


Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Charity Ball Organizer Many charities support good causes, but one of the difficulties each of them has is organizing their fundraising events. After nearly a semester of C progra

Yes. "Memory pools" are useful in many situations. The bad news is that I'll need to drag you through the mire of how it acts before we talk about all the uses. Firstly, recall