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

Assignment Help:

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

 

 


Related Discussions:- C program to find the even words in the string

CGI, WHAT IS CGI?

WHAT IS CGI?

Record of student and calculating marks using ctotal, reocord of a student ...

reocord of a student and a function ctotal to calculate the marks of any three subject by using ctotal() function

How many ways are there to initialize an int with a constant, There are two...

There are two ways for initializes in C++ as shown in the example that follows. The first way uses the traditional C notation. The second way uses constructor notation. int foo

Problem : Luminous Jewels - Polishing Necklace, Byteland county is very fam...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Create cpp code for identify objects and their relationships, You are setti...

You are setting up an information system for a DVD Rental Company called Box office. The new system need to hold information about customers and DVDs rentals, payments and fines. C

Define commonly used built-in library functions, Define Commonly Used Built...

Define Commonly Used Built-in Library Functions? Comprise opened a file pointer you will desire to use it for either input or output. The C language supplies a set of functions

Ice_Cream Game, Do you have any solution on this activity?

Do you have any solution on this activity?

Program of conversion between objects of different classes, Conversion betw...

Conversion between Objects of Different Classes As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a functio

Padovan string, #questio#A Padovan string P(n) for a natural number n is de...

#questio#A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd