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

I want application to generate premium, Project Description: We want to ...

Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers

Define the bitwise operators in c language, Define the Bitwise Operators in...

Define the Bitwise Operators in c language? C has distinction of supporting special operators that known as bit wise operators for manipulation of data at bit level. These oper

Displays the temperature conversion chart on the screen, Write a program th...

Write a program that displays the following temperature conversion chart on the screen as follows below. Hint: c = 5.0/9.0 * (f - 2) C = degrees in Celsius F = degree in F

Coding, Problem Statement: You have to write a C program to develop a Car P...

Problem Statement: You have to write a C program to develop a Car Parking Management System for a busy commercial area. The system will record the car plate number, date and time w

Write a simple telephone book program, Write a simple telephone book progra...

Write a simple telephone book program that stores the names and phone numbers of your friends/acquaintances in a file. Your program should have the abilities to: a. Add entries (n

Assignment problem, how to write c code to solve assignment problem?

how to write c code to solve assignment problem?

Decoding, how to decode a number from mobile keypad

how to decode a number from mobile keypad

Code, how to write c++ for function f(x)= 2x^3 -x^2 +10

how to write c++ for function f(x)= 2x^3 -x^2 +10

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