normal 0 false false false en-us x-none


void main()

{

          int i=0,k=0,word=0;

          char a[30],temp;

          clrscr();

          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')

                   {

                             word++;

                             temp=a[k];

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

                             a[i-1]=temp;

                             k=i+1;

                   }

          }

          printf("%s",a);

          if(word%2==0)

                    printf("\nNO OF WORDS ARE %d",word);

          getch();

}


OUTPUT

-ENTER THE STRING: KAMLESH

AMLESHK

MLESHKA

LESHKAM

ESHKAML

SHKAMLE

HKAMLES

KAMLESH

 

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: normal 0 false false false en-us x-none
Reference No:- TGS0159304

Expected delivery within 24 Hours