C program count characters words with space & without space , C/C++ Programming

Assignment Help:

void main()

{

          int i,j,len=0,word=1,lens=0,ll=1;

          char str[100];

          clrscr();

          printf("ENTER THE STRING: ");

          gets(str);

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

          {

              len++;

                   if(str[i]==' ')

                          word++;

                   else

                         lens++;

          }

          printf("CHARACTERS WITH SPACE : %d\n",len);

          printf("CHARACTERS WITHOUT SPACE : %d",lens);

          printf("\n                    WORDS : %d",word);

          getch();

}


OUTPUT :

ENTER THE STRING: KAMLESH MENGAR

       CHARACTERS WITH SPACE : 14

CHARACTERS WITHOUT SPACE : 13

                                          WORDS : 2



Related Discussions:- C program count characters words with space & without space

Palindrome, A palindrome is a string that reads the same from both the ends...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Area under curve, a program to find the area under curve y=f(x) between x=a...

a program to find the area under curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b.

Advanced features of c, We are now quite happy to use the basic mathematica...

We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos  , ln etc . Within C we have the following functi

Eevrv, Ask question #Mi fd d fffffffffffffffffffffffffffffffffffffffffff...

Ask question #Mi fd d fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Write a program that illustrate command line parameters, Write a Program th...

Write a Program that illustrate Command Line Parameters? main(int argc, char *argv[]) { int i; for(i = 0; i printf("arg %d: %s\n", i, argv[i]); return 0; }

I need online game dvelopment, Project Description: Online game developm...

Project Description: Online game development Online Live Baccarat Game is needed - client program. - server program(IOCP or ect..). - web program(ASP or PHP or etc..

How do i allocate multidimensional arrays by new? , Can I free() pointers a...

Can I free() pointers allocated  along with new? Can I delete pointers allocated along with malloc()? A: No. It is completely legal, moral, and wholesome to employ malloc() a

Explain operators, Operators The variables, which are declared and expl...

Operators The variables, which are declared and explained, are the operands, which are operated upon by the operators. Operators specify what operations are to be performed on

Described assignment operator?, Default assignment operator mange assigning...

Default assignment operator mange assigning one object to another object of the same class. It is member to member copy as shallow copy.

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